diff --git a/tests/cases/checker/04_custom_types.py b/tests/cases/checker/04_custom_types.py index 93569b8..c015a75 100644 --- a/tests/cases/checker/04_custom_types.py +++ b/tests/cases/checker/04_custom_types.py @@ -1,8 +1,6 @@ # type: ignore # ruff: disable [F821] -midas.using("04_custom_types.midas") - distance: Meter = cast(Meter, 123.45) time: Second = cast(Second, 6.7) speed = distance / time diff --git a/tests/cases/python-parser/02_custom_types.py b/tests/cases/python-parser/02_custom_types.py index 32dbab3..1725bf4 100644 --- a/tests/cases/python-parser/02_custom_types.py +++ b/tests/cases/python-parser/02_custom_types.py @@ -2,10 +2,6 @@ # ruff: disable[F821] from __future__ import annotations -import midas - -midas.using("02_custom_types.midas") - df: Frame[ location: GeoLocation ] diff --git a/tests/cases/python-parser/02_custom_types.py.ref.json b/tests/cases/python-parser/02_custom_types.py.ref.json index 49b861f..639610d 100644 --- a/tests/cases/python-parser/02_custom_types.py.ref.json +++ b/tests/cases/python-parser/02_custom_types.py.ref.json @@ -1,26 +1,5 @@ { "stmts": [ - { - "_type": "ExpressionStmt", - "expr": { - "_type": "CallExpr", - "callee": { - "_type": "GetExpr", - "object": { - "_type": "VariableExpr", - "name": "midas" - }, - "name": "using" - }, - "arguments": [ - { - "_type": "LiteralExpr", - "value": "02_custom_types.midas" - } - ], - "keywords": {} - } - }, { "_type": "TypeAssign", "name": "df", diff --git a/tests/checker.py b/tests/checker.py index 0383132..d0a7b3e 100644 --- a/tests/checker.py +++ b/tests/checker.py @@ -33,6 +33,10 @@ class CheckerTester(Tester): if not path.is_file(): raise TypeError(f"Test '{path}' is not a file") + types_paths: list[Path] = [] + types_path: Path = path.with_suffix(".midas") + if types_path.exists(): + types_paths.append(types_path) source: str = path.read_text() tree: ast.Module = ast.parse(source, filename=path) parser = PythonParser() @@ -40,7 +44,11 @@ class CheckerTester(Tester): resolver = Resolver() resolver.resolve(*stmts) result: CaseResult = CaseResult() - checker = Checker(resolver.locals, file_path=path) + checker = Checker( + resolver.locals, + source_path=path, + types_paths=types_paths, + ) diagnostics: list[Diagnostic] = checker.check(stmts) for diagnostic in diagnostics: result.diagnostics.append(