test_float.py 489 B

123456789101112131415161718
  1. import sys
  2. import unittest
  3. import math
  4. class FloatTestCases(unittest.TestCase):
  5. def test_conjugate(self):
  6. self.assertEqual(float(3.0).conjugate(), 3.0)
  7. self.assertEqual(int(-3.0).conjugate(), -3.0)
  8. def test_inf(self):
  9. self.assertTrue(math.isinf(float('Inf')))
  10. self.assertFalse(math.isinf(42))
  11. self.assertFalse(math.isinf(42.1))
  12. self.assertRaises(TypeError, lambda: math.isinf("42"))
  13. if __name__ == '__main__':
  14. unittest.main()