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

Method test_underscores

Lib/test/test_complex.py:735–745  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

733 self.assertEqual(copysign(1., complex("-nan-nanj").imag), -1.)
734
735 def test_underscores(self):
736 # check underscores
737 for lit in VALID_UNDERSCORE_LITERALS:
738 if not any(ch in lit for ch in 'xXoObB'):
739 self.assertEqual(complex(lit), eval(lit))
740 self.assertEqual(complex(lit), complex(lit.replace('_', '')))
741 for lit in INVALID_UNDERSCORE_LITERALS:
742 if lit in ('0_7', '09_99'): # octals are not recognized here
743 continue
744 if not any(ch in lit for ch in 'xXoObB'):
745 self.assertRaises(ValueError, complex, lit)
746
747 def test_from_number(self, cls=complex):
748 def eq(actual, expected):

Callers

nothing calls this directly

Calls 5

anyFunction · 0.50
evalFunction · 0.50
assertEqualMethod · 0.45
replaceMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected