class FloatTypeTests(TypeTestHelper, unittest.TestCase): type = types.Float() def test_decimal_format(self): v = self.type_instance('123.456') self.assertAlmostEqual(v, 123.456) def test_decimal_format_negative_float(self): v = self.type_instance('-123.456') self.assertAlmostEqual(v, -123.456) def test_exponential_format(self): v = self.type_instance('123e-2') self.assertAlmostEqual(v, 1.23) def test_non_float_is_invalid(self): self.assertInvalid('123,345') self.assertInvalid('foo') def test_repr(self): self.assertEqual('Float', repr(types.Float())) def test_equal(self): self.assertTrue(types.Float() == types.Float()) def test_not_equal_to_other_class(self): self.assertFalse(types.Float() == types.Integer())
def test_not_equal_to_other_class(self): self.assertFalse(types.Float() == types.Integer())
def test_equal(self): self.assertTrue(types.Float() == types.Float())
def test_repr(self): self.assertEqual('Float', repr(types.Float()))