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

Method test_long_isnegative

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

Source from the content-addressed store, hash-verified

659 # CRASHES ispositive(NULL)
660
661 def test_long_isnegative(self):
662 # Test PyLong_IsNegative()
663 isnegative = _testcapi.pylong_isnegative
664 self.assertEqual(isnegative(1), 0)
665 self.assertEqual(isnegative(123), 0)
666 self.assertEqual(isnegative(-1), 1)
667 self.assertEqual(isnegative(0), 0)
668 self.assertEqual(isnegative(True), 0)
669 self.assertEqual(isnegative(False), 0)
670 self.assertEqual(isnegative(IntSubclass(-1)), 1)
671 self.assertRaises(TypeError, isnegative, 1.0)
672 self.assertRaises(TypeError, isnegative, Index(123))
673
674 # CRASHES isnegative(NULL)
675
676 def test_long_iszero(self):
677 # Test PyLong_IsZero()

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