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

Method check_different_constants

Lib/test/test_compile.py:1007–1017  ·  view source on GitHub ↗
(const1, const2)

Source from the content-addressed store, hash-verified

1005 # but have a different type.
1006
1007 def check_different_constants(const1, const2):
1008 ns = {}
1009 exec("f1, f2 = lambda: %r, lambda: %r" % (const1, const2), ns)
1010 f1 = ns['f1']
1011 f2 = ns['f2']
1012 self.assertIsNot(f1.__code__, f2.__code__)
1013 self.assertNotEqual(f1.__code__, f2.__code__)
1014 self.check_constant(f1, const1)
1015 self.check_constant(f2, const2)
1016 self.assertEqual(repr(f1()), repr(const1))
1017 self.assertEqual(repr(f2()), repr(const2))
1018
1019 check_different_constants(+0.0, -0.0)
1020 check_different_constants((0,), (0.0,))

Callers

nothing calls this directly

Calls 8

check_constantMethod · 0.95
reprFunction · 0.85
assertIsNotMethod · 0.80
assertNotEqualMethod · 0.80
f1Function · 0.70
f2Function · 0.70
execFunction · 0.50
assertEqualMethod · 0.45

Tested by

no test coverage detected