MCPcopy Create free account
hub / github.com/python-hyper/uritemplate / FixtureMixin

Class FixtureMixin

tests/test_from_fixtures.py:39–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38
39class 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
63class TestSpecExamples(FixtureMixin):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…