# Pastebin Lnlrrgib class NumericTester(unittest.TestCase): '''Helper class for numeric comparison testing''' def check_value(self, source, expected, callback, desired_type=None): result = callback(source) self.assertEqual(result, expected) if desired_type: self.assertEqual(type(result), desired_type) class FloatImplicitConvert(NumericTester): '''Test case for implicit converting C++ numeric types.''' def testFloatAsInt(self): '''Float as Int''' self.check_value(3.14, 3, sample.acceptInt, int) self.assertRaises(OverflowError, sample.acceptInt, cIntMax + 400)