def test_float(self): self.assertRaises(TypeError, Float, 'sql injection') try: Float(True) except TypeError: self.fail("Float() raised TypeError on bool.")
def test_string(self): string = 'dsadsa sdsadas sd as' db_value = String(string).as_sql() % String(string).get_params()[0] self.assertEqual(Float.to_python(db_value), string)
def test_float(self): f = 3.2 db_value = float(Float(f).as_sql()) self.assertEqual(Float.to_python(db_value), f)