MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_constant

Method check_constant

Lib/test/test_compile.py:782–788  ·  view source on GitHub ↗
(self, func, expected)

Source from the content-addressed store, hash-verified

780 self.assertEqual(namespace['x'], 12)
781
782 def check_constant(self, func, expected):
783 for const in func.__code__.co_consts:
784 if repr(const) == repr(expected):
785 break
786 else:
787 self.fail("unable to find constant %r in %r"
788 % (expected, func.__code__.co_consts))
789
790 # Merging equal constants is not a strict requirement for the Python
791 # semantics, it's a more an implementation detail.

Callers 4

check_same_constantMethod · 0.95
test_merge_constantsMethod · 0.95

Calls 2

reprFunction · 0.85
failMethod · 0.45

Tested by

no test coverage detected