MCPcopy Index your code
hub / github.com/python/cpython / check_different_constants

Method check_different_constants

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

check_constantMethod · 0.95
f1Function · 0.85
f2Function · 0.85
assertIsNotMethod · 0.80
assertNotEqualMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected