示例#1
0
 def test_empty_string(self):
     with self.assertRaises(forms.ValidationError):
         (validators.value_numbers(""))
示例#2
0
 def test_valid(self):
     self.assertIsNone(validators.value_numbers({"v": 123.00, "d": 321}))
示例#3
0
 def test_invalid(self):
     with self.assertRaises(forms.ValidationError):
         validators.value_numbers({"v": "$123.00", "d": "321,00"})
示例#4
0
 def test_valid_str(self):
     self.assertIsNone(
         validators.value_numbers({
             "v": "123.00",
             "d": "321,00"
         }))
示例#5
0
 def test_json_invalid(self):
     d = json.dumps({"v": "123.00", "d": "$321,00"})
     with self.assertRaises(forms.ValidationError):
         validators.value_numbers(d)
示例#6
0
 def test_json_none_invalid(self):
     d = json.dumps({"v": None, "d": 321})
     with self.assertRaises(forms.ValidationError):
         validators.value_numbers(d)
示例#7
0
 def test_json_valid(self):
     d = json.dumps({"v": 123.00, "d": 321})
     self.assertIsNone(validators.value_numbers(d))
示例#8
0
 def test_json_valid_str(self):
     d = json.dumps({"v": "123.00", "d": "321,00"})
     self.assertIsNone(validators.value_numbers(d))