Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/pysimlin-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ fi

cd "$REPO_ROOT"

echo "Running pysimlin linting..."
uv run --directory src/pysimlin ruff check .

echo "Running pysimlin type checking..."
uv run --directory src/pysimlin mypy simlin/

Expand Down
20 changes: 12 additions & 8 deletions src/pysimlin/tests/test_json_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ def stock_strategy(draw: Any) -> Stock:
nn = draw(st.booleans())
cbmi = draw(st.booleans())
is_pub = draw(st.booleans())
compat = Compat(non_negative=nn, can_be_module_input=cbmi, is_public=is_pub) if (nn or cbmi or is_pub) else None
compat = (
Compat(non_negative=nn, can_be_module_input=cbmi, is_public=is_pub)
if (nn or cbmi or is_pub)
else None
)
return Stock(
name=draw(ident_strategy()),
inflows=draw(st.lists(ident_strategy(), min_size=0, max_size=3)),
Expand All @@ -158,7 +162,11 @@ def flow_strategy(draw: Any) -> Flow:
nn = draw(st.booleans())
cbmi = draw(st.booleans())
is_pub = draw(st.booleans())
compat = Compat(non_negative=nn, can_be_module_input=cbmi, is_public=is_pub) if (nn or cbmi or is_pub) else None
compat = (
Compat(non_negative=nn, can_be_module_input=cbmi, is_public=is_pub)
if (nn or cbmi or is_pub)
else None
)

return Flow(
name=draw(ident_strategy()),
Expand Down Expand Up @@ -545,9 +553,7 @@ def test_optional_bool_false_vs_default(self) -> None:
# Compat with all-default fields should be omitted
flow_default = Flow(name="test", compat=Compat())
result_default = converter.unstructure(flow_default)
assert "compat" not in result_default, (
"compat with all defaults should be omitted"
)
assert "compat" not in result_default, "compat with all defaults should be omitted"

# Compat with non-default should be included
flow_nn = Flow(name="test", compat=Compat(non_negative=True))
Expand All @@ -558,9 +564,7 @@ def test_empty_graphical_function_not_dropped(self) -> None:
"""An empty GraphicalFunction should not be elided like Compat."""
flow = Flow(name="test", graphical_function=GraphicalFunction())
result = converter.unstructure(flow)
assert "graphicalFunction" in result, (
"empty GraphicalFunction should not be dropped"
)
assert "graphicalFunction" in result, "empty GraphicalFunction should not be dropped"


class TestLegacyCompatMerge:
Expand Down