diff --git a/tests/test_packer.py b/tests/test_packer.py index ab69583..ce6db6c 100644 --- a/tests/test_packer.py +++ b/tests/test_packer.py @@ -208,8 +208,8 @@ def test_cross_library_transitive_dep(self, tmp_path): "module scaled_box(s) { cube(scale_val(s)); }") entry = write(tmp_path, "entry.scad", "use \nscaled_box(5);") - # Note: use inside shapes.scad is processed with process_includes=True, - # so scale_val ends up in the pool via shapes.scad's flattened parse + # shapes.scad itself references math.scad, and packing resolves that dependency + # when processing the library, so scaled_box can be emitted correctly. result = pack(entry) assert "scaled_box" in result @@ -373,7 +373,7 @@ def test_escaped_quote_inside_string_preserved(self): def test_unterminated_string_at_eof_handled(self): # A string literal that reaches EOF without a closing `"` must not crash — - # exercises the `while i < len(code)` exit-without-break branch (58->68). + # exercises the string-scanning loop path where EOF is reached before a closing quote. result = _strip_expression_comments('"unclosed') assert '"unclosed' in result @@ -459,8 +459,8 @@ def test_fallback_warning_when_string_parse_fails(self, tmp_path, capsys, monkey assert "warning" in captured.err.lower() def test_fallback_no_warning_for_empty_file(self, tmp_path, capsys, monkeypatch): - # When getASTfromString fails AND the file is empty, the fallback also returns - # nothing — `if nodes:` is False so no warning is printed (branch 239->245). + # When getASTfromString fails and the file is empty, the fallback returns + # no nodes, so `if nodes:` is False and no warning is printed. entry = write(tmp_path, "entry.scad", "") monkeypatch.setattr("openscad_packer.packer.getASTfromString", lambda *a, **kw: None) result = Packer(str(entry), []).pack() diff --git a/tests/test_resolver.py b/tests/test_resolver.py index 4de9f29..0031b4d 100644 --- a/tests/test_resolver.py +++ b/tests/test_resolver.py @@ -1,8 +1,6 @@ """Unit tests for openscad_packer.resolver.""" from pathlib import Path -import pytest - from openscad_packer.resolver import resolve_library diff --git a/tests/test_shaker.py b/tests/test_shaker.py index 1c0a0c8..9a5e5a9 100644 --- a/tests/test_shaker.py +++ b/tests/test_shaker.py @@ -1,7 +1,6 @@ """Unit tests for openscad_packer.shaker.""" from pathlib import Path -import pytest from openscad_parser.ast import getASTfromFile from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration @@ -24,7 +23,7 @@ def make_pool(tmp_path: Path, content: str) -> dict: if name not in pool: pool[name] = [] for i, existing in enumerate(pool[name]): - if type(existing) is type(node): + if isinstance(existing, type(node)): pool[name][i] = node break else: diff --git a/tests/test_upstream_patches.py b/tests/test_upstream_patches.py index 518b351..0d8ea57 100644 --- a/tests/test_upstream_patches.py +++ b/tests/test_upstream_patches.py @@ -127,14 +127,15 @@ def test_three_arg_range_explicit_step_preserved(self, tmp_path): assert "[0:1:2]" in out def test_three_arg_range_large_step_preserved(self, tmp_path): - # [0:5:1] means start=0, step=5, end=1 — semantically different from [0:5] + # [0:5:1] means start=0, step=5, end=1 — semantically different from [0:1] + # ([0:5] is a two-arg range: start=0, end=5, implicit step=1.) src = "x = [for (i=[0:5:1]) i];" out = parse_and_print(tmp_path / "t.scad", src) assert "[0:5:1]" in out assert "[0:5]" not in out def test_three_arg_range_negative_step_preserved(self, tmp_path): - # [10:0:-1] means start=10, step=0, end=-1 in internal storage + # [10:-1:0] means start=10, step=-1, end=0 in internal storage src = "x = [for (i=[10:-1:0]) i];" out = parse_and_print(tmp_path / "t.scad", src) assert "[10:-1:0]" in out