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

Method test_long_iszero

Lib/test/test_capi/test_long.py:676–689  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

674 # CRASHES isnegative(NULL)
675
676 def test_long_iszero(self):
677 # Test PyLong_IsZero()
678 iszero = _testcapi.pylong_iszero
679 self.assertEqual(iszero(1), 0)
680 self.assertEqual(iszero(-1), 0)
681 self.assertEqual(iszero(0), 1)
682 self.assertEqual(iszero(True), 0)
683 self.assertEqual(iszero(False), 1)
684 self.assertEqual(iszero(IntSubclass(-1)), 0)
685 self.assertEqual(iszero(IntSubclass(0)), 1)
686 self.assertRaises(TypeError, iszero, 1.0)
687 self.assertRaises(TypeError, iszero, Index(123))
688
689 # CRASHES iszero(NULL)
690
691 def test_long_asint32(self):
692 # Test PyLong_AsInt32() and PyLong_FromInt32()

Callers

nothing calls this directly

Calls 4

IntSubclassClass · 0.70
IndexClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected