123456789101112131415161718 |
- import sys
- import unittest
- import math
- class FloatTestCases(unittest.TestCase):
- def test_conjugate(self):
- self.assertEqual(float(3.0).conjugate(), 3.0)
- self.assertEqual(int(-3.0).conjugate(), -3.0)
- def test_inf(self):
- self.assertTrue(math.isinf(float('Inf')))
- self.assertFalse(math.isinf(42))
- self.assertFalse(math.isinf(42.1))
- self.assertRaises(TypeError, lambda: math.isinf("42"))
- if __name__ == '__main__':
- unittest.main()
|