def test_format(self): f = MoneyDbField(max_digits=5, decimal_places=3) self.assertEqual(f._format(f.to_python(2)), '2.000') self.assertEqual(f._format(f.to_python('2.34567')), '2.346') self.assertEqual(f._format(None), None)
def test_format(): f = MoneyDbField(max_digits=5, decimal_places=3) assert f._format(f.to_python(2)) == '2.000' assert f._format(f.to_python('2.34567')) == '2.346' assert f._format(None) is None