Coverage for tests/test_generation/utils.py: 100%
17 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-08-27 18:25 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-08-27 18:25 +0000
1from typing import Iterator
2from pathlib import Path
4from prisma.generator.utils import resolve_template_path
7def iter_templates_dir(path: Path) -> Iterator[Path]:
8 templates = path / 'generator' / 'templates'
9 assert templates.exists()
11 for template in templates.iterdir():
12 name = template.name
14 if template.is_dir() or not name.endswith('.py.jinja') or name.startswith('_'):
15 continue
17 yield resolve_template_path(path, template.relative_to(templates))
20def assert_module_is_clean(path: Path) -> None:
21 for template in iter_templates_dir(path):
22 assert not template.exists()
25def assert_module_not_clean(path: Path) -> None:
26 for template in iter_templates_dir(path):
27 assert template.exists()