diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f126e6..6a52db4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,6 +34,12 @@ Once `h5grove` is installed in editable mode, run the tests with invoke test ``` +Available options (cf. `invoke --help test`): + +- `-c`, `--cov-lines`: display line numbers in coverage report +- `-k [keyword]`, `--keyword [keyword]`: filter tests by keyword +- `-v`, `--verbose`: enable verbose test output + ### Benchmarks Benchmarks of different formats (`json`, `.npy`) and web server frameworks (`flask`, `tornado`) are run as part of the tests. Those benchmarks are based on [pytest-benchmark](https://pytest-benchmark.readthedocs.io/en/latest/). diff --git a/h5grove/encoders.py b/h5grove/encoders.py index f054e99..4d20fe1 100644 --- a/h5grove/encoders.py +++ b/h5grove/encoders.py @@ -111,10 +111,6 @@ def encode(content: Any, encoding: Optional[str] = "json") -> Response: ) content_array = np.array(content, copy=False) - if not is_numeric_data(content_array): - raise QueryArgumentError( - f"Unsupported encoding {encoding} for non-numeric content" - ) if encoding == "bin": return Response( @@ -124,6 +120,11 @@ def encode(content: Any, encoding: Optional[str] = "json") -> Response: }, ) + if not is_numeric_data(content_array): + raise QueryArgumentError( + f"Unsupported encoding {encoding} for non-numeric content" + ) + if encoding == "csv": return Response( csv_encode(content_array), diff --git a/tasks.py b/tasks.py index 8e851e7..e84ac07 100644 --- a/tasks.py +++ b/tasks.py @@ -31,7 +31,7 @@ def lint(c): mypy(c) -@task +@task(optional=["verbose", "keyword", "cov-lines"]) def test(c, verbose=False, keyword="", cov_lines=False): """Test without benchmark""" c.run(