mirror of
https://github.com/p2p-ld/numpydantic.git
synced 2024-11-14 10:44:28 +00:00
format and also add pdm scripts
This commit is contained in:
parent
8f1eb6e5b4
commit
7dbb22f828
5 changed files with 10 additions and 3 deletions
|
@ -96,6 +96,12 @@ distribution = true
|
||||||
|
|
||||||
[tool.pdm.build]
|
[tool.pdm.build]
|
||||||
includes = []
|
includes = []
|
||||||
|
|
||||||
|
[tool.pdm.scripts]
|
||||||
|
lint = "ruff check"
|
||||||
|
format = {shell = "ruff check --fix ; black ."}
|
||||||
|
test = "pytest"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["pdm-backend"]
|
requires = ["pdm-backend"]
|
||||||
build-backend = "pdm.backend"
|
build-backend = "pdm.backend"
|
||||||
|
|
2
tests/fixtures/generation.py
vendored
2
tests/fixtures/generation.py
vendored
|
@ -25,7 +25,7 @@ def hdf5_array(
|
||||||
) -> H5ArrayPath:
|
) -> H5ArrayPath:
|
||||||
array_path = "/" + "_".join([str(s) for s in shape]) + "__" + dtype.__name__
|
array_path = "/" + "_".join([str(s) for s in shape]) + "__" + dtype.__name__
|
||||||
generator = np.random.default_rng()
|
generator = np.random.default_rng()
|
||||||
|
|
||||||
if not compound:
|
if not compound:
|
||||||
if dtype is str:
|
if dtype is str:
|
||||||
data = generator.random(shape).astype(bytes)
|
data = generator.random(shape).astype(bytes)
|
||||||
|
|
|
@ -91,7 +91,7 @@ def interfaces():
|
||||||
|
|
||||||
def test_interface_match_error(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
|
are found
|
||||||
"""
|
"""
|
||||||
with pytest.raises(ValueError) as e:
|
with pytest.raises(ValueError) as e:
|
||||||
|
|
|
@ -91,6 +91,7 @@ def test_schema_number():
|
||||||
|
|
||||||
def test_ndarray_union():
|
def test_ndarray_union():
|
||||||
generator = np.random.default_rng()
|
generator = np.random.default_rng()
|
||||||
|
|
||||||
class Model(BaseModel):
|
class Model(BaseModel):
|
||||||
array: Optional[
|
array: Optional[
|
||||||
Union[
|
Union[
|
||||||
|
|
|
@ -116,7 +116,7 @@ def test_absolute_path(hdf5_at_path, tmp_output_dir, model_blank):
|
||||||
|
|
||||||
def test_walk_and_apply():
|
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
|
nesty structure
|
||||||
"""
|
"""
|
||||||
test = {
|
test = {
|
||||||
|
|
Loading…
Reference in a new issue