def testFromFloat(self):
    self.assertRaises(TypeError, F.from_float, (3 + 4j))
    self.assertEqual((10, 1), _components(F.from_float(10)))
    bigint = 1234567890123456789
    self.assertEqual((bigint, 1), _components(F.from_float(bigint)))
    self.assertEqual((0, 1), _components(F.from_float((- 0.0))))
    self.assertEqual((10, 1), _components(F.from_float(10.0)))
    self.assertEqual(((- 5), 2), _components(F.from_float((- 2.5))))
    self.assertEqual((99999999999999991611392, 1), _components(F.from_float(1e+23)))
    self.assertEqual(float((10 ** 23)), float(F.from_float(1e+23)))
    self.assertEqual((3602879701896397, 1125899906842624), _components(F.from_float(3.2)))
    self.assertEqual(3.2, float(F.from_float(3.2)))
    inf = 1e309
    nan = (inf - inf)
    self.assertRaisesMessage(OverflowError, 'cannot convert Infinity to integer ratio', F.from_float, inf)
    self.assertRaisesMessage(OverflowError, 'cannot convert Infinity to integer ratio', F.from_float, (- inf))
    self.assertRaisesMessage(ValueError, 'cannot convert NaN to integer ratio', F.from_float, nan)
def testFromFloat(self):
    self.assertRaises(TypeError, F.from_float, (3 + 4j))
    self.assertEqual((10, 1), _components(F.from_float(10)))
    bigint = 1234567890123456789
    self.assertEqual((bigint, 1), _components(F.from_float(bigint)))
    self.assertEqual((0, 1), _components(F.from_float((- 0.0))))
    self.assertEqual((10, 1), _components(F.from_float(10.0)))
    self.assertEqual(((- 5), 2), _components(F.from_float((- 2.5))))
    self.assertEqual((99999999999999991611392, 1), _components(F.from_float(1e+23)))
    self.assertEqual(float((10 ** 23)), float(F.from_float(1e+23)))
    self.assertEqual((3602879701896397, 1125899906842624), _components(F.from_float(3.2)))
    self.assertEqual(3.2, float(F.from_float(3.2)))
    inf = 1e309
    nan = (inf - inf)
    self.assertRaisesMessage(OverflowError, 'cannot convert Infinity to integer ratio', F.from_float, inf)
    self.assertRaisesMessage(OverflowError, 'cannot convert Infinity to integer ratio', F.from_float, (- inf))
    self.assertRaisesMessage(ValueError, 'cannot convert NaN to integer ratio', F.from_float, nan)