| 37 | |
| 38 | |
| 39 | class FixtureMixin: |
| 40 | examples: Examples |
| 41 | |
| 42 | def _get_test( |
| 43 | self, section: str |
| 44 | ) -> t.Tuple[ExampleVariables, ExampleTemplatesAndResults]: |
| 45 | test = t.cast(ExampleWithVariables, self.examples.get(section, {})) |
| 46 | return ( |
| 47 | test.get("variables", {}), |
| 48 | test.get("testcases", []), |
| 49 | ) |
| 50 | |
| 51 | def _test(self, testname: str) -> None: |
| 52 | variables, testcases = self._get_test(testname) |
| 53 | for template, expected in testcases: |
| 54 | expected_templates = expected_set(expected) |
| 55 | expanded = uritemplate.expand(template, variables) |
| 56 | assert expanded in expected_templates, ( # nosec |
| 57 | f"expanded {template!r} with {variables!r} " |
| 58 | f"and got {expanded!r} but expected one of " |
| 59 | f"{expected_templates!r}" |
| 60 | ) |
| 61 | |
| 62 | |
| 63 | class TestSpecExamples(FixtureMixin): |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…