From 7dbb22f8288ccfc6308f8e02504be979b356eb55 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Thu, 3 Oct 2024 20:01:56 -0700 Subject: [PATCH] format and also add pdm scripts --- pyproject.toml | 6 ++++++ tests/fixtures/generation.py | 2 +- tests/test_interface/test_interface_base.py | 2 +- tests/test_ndarray.py | 1 + tests/test_serialization.py | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 0f34c91..b861dbf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,6 +96,12 @@ distribution = true [tool.pdm.build] includes = [] + +[tool.pdm.scripts] +lint = "ruff check" +format = {shell = "ruff check --fix ; black ."} +test = "pytest" + [build-system] requires = ["pdm-backend"] build-backend = "pdm.backend" diff --git a/tests/fixtures/generation.py b/tests/fixtures/generation.py index 05f68b0..b1de6ea 100644 --- a/tests/fixtures/generation.py +++ b/tests/fixtures/generation.py @@ -25,7 +25,7 @@ def hdf5_array( ) -> H5ArrayPath: array_path = "/" + "_".join([str(s) for s in shape]) + "__" + dtype.__name__ generator = np.random.default_rng() - + if not compound: if dtype is str: data = generator.random(shape).astype(bytes) diff --git a/tests/test_interface/test_interface_base.py b/tests/test_interface/test_interface_base.py index 1aa17e1..f82d0a5 100644 --- a/tests/test_interface/test_interface_base.py +++ b/tests/test_interface/test_interface_base.py @@ -91,7 +91,7 @@ def interfaces(): def test_interface_match_error(interfaces): """ - Test that `match` and `match_output` raises errors when no or multiple matches + Test that `match` and `match_output` raises errors when no or multiple matches are found """ with pytest.raises(ValueError) as e: diff --git a/tests/test_ndarray.py b/tests/test_ndarray.py index 4282279..18d035b 100644 --- a/tests/test_ndarray.py +++ b/tests/test_ndarray.py @@ -91,6 +91,7 @@ def test_schema_number(): def test_ndarray_union(): generator = np.random.default_rng() + class Model(BaseModel): array: Optional[ Union[ diff --git a/tests/test_serialization.py b/tests/test_serialization.py index 4042e08..17f2cfe 100644 --- a/tests/test_serialization.py +++ b/tests/test_serialization.py @@ -116,7 +116,7 @@ def test_absolute_path(hdf5_at_path, tmp_output_dir, model_blank): def test_walk_and_apply(): """ - Walk and apply should recursively apply a function to everything in a + Walk and apply should recursively apply a function to everything in a nesty structure """ test = {