示例#1
0
 def test_invalid_decimal(self):
     instance = PreProcessorTesting()
     instance.field_1 = "foo"
     self.assertEqual(instance.field_1, 0)
     self.assertEqual(instance.field_2, 1)
     instance.save()
     self.assertEqual(instance.field_1, 1)
     self.assertEqual(instance.field_2, 1)
示例#2
0
 def test_valid_decimal(self):
     instance = PreProcessorTesting()
     instance.field_1 = "56.1"
     self.assertEqual(instance.field_1, Decimal('56.1'))
     self.assertEqual(instance.field_2, 57)
     instance.save()
     self.assertEqual(instance.field_1, Decimal('57.1'))
     self.assertEqual(instance.field_2, 57)