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

Method test_long_ispositive

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

Source from the content-addressed store, hash-verified

644 # CRASHES getsign(NULL)
645
646 def test_long_ispositive(self):
647 # Test PyLong_IsPositive()
648 ispositive = _testcapi.pylong_ispositive
649 self.assertEqual(ispositive(1), 1)
650 self.assertEqual(ispositive(123), 1)
651 self.assertEqual(ispositive(-1), 0)
652 self.assertEqual(ispositive(0), 0)
653 self.assertEqual(ispositive(True), 1)
654 self.assertEqual(ispositive(False), 0)
655 self.assertEqual(ispositive(IntSubclass(-1)), 0)
656 self.assertRaises(TypeError, ispositive, 1.0)
657 self.assertRaises(TypeError, ispositive, Index(123))
658
659 # CRASHES ispositive(NULL)
660
661 def test_long_isnegative(self):
662 # Test PyLong_IsNegative()

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