def testUnsignedLongLong(self): '''C++ function receives an unsigned long long argument and raise OverflowError if the value is negative.''' val = 100 self.assertEqual(doubleUnsignedLongLong(val), 2 * val) val = long(100) self.assertEqual(doubleUnsignedLongLong(val), 2 * val) val = -100 self.assertRaises(OverflowError, doubleUnsignedLongLong, val) val = long(-200) self.assertRaises(OverflowError, doubleUnsignedLongLong, val)
def testLongLong(self): '''C++ function receives an long long argument and raise OverflowError if the value is negative.''' val = 100 self.assertEqual(doubleLongLong(val), 2 * val) val = long(100) self.assertEqual(doubleLongLong(val), 2 * val) val = (2 << 64) + 1 self.assertRaises(OverflowError, doubleLongLong, val)
def testSetNum(self): b = QByteArray() b.setNum(py3k.long(-124124)) self.assertEqual(b, "-124124") b = QByteArray() b.setNum(-124124) self.assertEqual(b, "-124124") b = QByteArray() b.setNum(-0.5) self.assertEqual(b, "-0.5")