def test_PyInt_Long(self): requires("refcount") ref42 = grc(42) pythonapi.PyInt_FromLong.restype = py_object self.assertEqual(pythonapi.PyInt_FromLong(42), 42) self.assertEqual(grc(42), ref42) pythonapi.PyInt_AsLong.argtypes = (py_object, ) pythonapi.PyInt_AsLong.restype = c_long res = pythonapi.PyInt_AsLong(42) self.assertEqual(grc(res), ref42 + 1) del res self.assertEqual(grc(42), ref42)
def test_PyInt_Long(self): requires("refcount") ref42 = grc(42) pythonapi.PyInt_FromLong.restype = py_object self.assertEqual(pythonapi.PyInt_FromLong(42), 42) self.assertEqual(grc(42), ref42) pythonapi.PyInt_AsLong.argtypes = (py_object,) pythonapi.PyInt_AsLong.restype = c_long res = pythonapi.PyInt_AsLong(42) self.assertEqual(grc(res), ref42 + 1) del res self.assertEqual(grc(42), ref42)
def test_SEH(self): requires("SEH") # Call functions with invalid arguments, and make sure # that access violations are trapped and raise an # exception. self.assertRaises(WindowsError, windll.kernel32.GetModuleHandleA, 32)