Skip to content
Merged
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
4 changes: 3 additions & 1 deletion tests/test_shaker.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
"""Unit tests for openscad_packer.shaker."""
from pathlib import Path
from typing import Any

from openscad_parser.ast import getASTfromFile
from openscad_parser.ast.nodes import FunctionDeclaration, ModuleDeclaration

from openscad_packer.shaker import collect_called_names, compute_reachable


def parse(tmp_path: Path, content: str) -> list:
def parse(tmp_path: Path, content: str) -> list[Any]:
f = tmp_path / "test.scad"
f.write_text(content)
return getASTfromFile(str(f), process_includes=False) or []
Expand Down Expand Up @@ -67,6 +68,7 @@ def test_collects_call_in_nested_module_body(self, tmp_path):
def test_collects_function_call_inside_module(self, tmp_path):
names = collect_called_names(parse(tmp_path, "module foo(s) { cube(scale(s)); }"))
assert "scale" in names
assert "cube" in names

def test_collects_call_in_assignment_rhs(self, tmp_path):
names = collect_called_names(parse(tmp_path, "x = double(5);"))
Expand Down
Loading