MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / test_check_wiki_example

Function test_check_wiki_example

tests/test_check_class_def.py:31–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29
30
31def test_check_wiki_example():
32 code = """
33class MyInt(int):
34 def __init__(self, i):
35 super().__init__(i + 1)
36"""
37 s = setup_state(code, code)
38 s.check_class_def("MyInt").multi(
39 check_bases(0).has_equal_ast(),
40 check_body()
41 .check_function_def("__init__")
42 .multi(
43 check_args("self"),
44 check_args("i"),
45 check_body()
46 .set_context(i=2)
47 .multi(
48 check_function("super", signature=False),
49 check_function("super.__init__").check_args(0).has_equal_value(),
50 ),
51 ),
52 )

Callers

nothing calls this directly

Calls 3

setup_stateFunction · 0.90
check_argsFunction · 0.85
check_functionFunction · 0.85

Tested by

no test coverage detected