(const)
| 795 | # and have the same type. |
| 796 | |
| 797 | def check_same_constant(const): |
| 798 | ns = {} |
| 799 | code = "f1, f2 = lambda: %r, lambda: %r" % (const, const) |
| 800 | exec(code, ns) |
| 801 | f1 = ns['f1'] |
| 802 | f2 = ns['f2'] |
| 803 | self.assertIs(f1.__code__.co_consts, f2.__code__.co_consts) |
| 804 | self.check_constant(f1, const) |
| 805 | self.assertEqual(repr(f1()), repr(const)) |
| 806 | |
| 807 | check_same_constant(None) |
| 808 | check_same_constant(0.0) |
nothing calls this directly
no test coverage detected