Exemplo n.º 1
0
 def test_latitude_field(self):
     f = LatitudeField()
     pytest.raises(ValidationError, f.clean, None)
     pytest.raises(ValidationError, f.clean, 'a')
     pytest.raises(ValidationError, f.clean, 92)
     pytest.raises(ValidationError, f.clean, -92)
     assert 12.345 == f.clean(12.345)
     assert -12.345 == f.clean(-12.345)
     assert 12.345 == f.clean('12.345')
     assert isinstance(f.clean(12.345), latitude)
Exemplo n.º 2
0
 def test_latitude_field(self):
     f = LatitudeField()
     self.assertRaises(ValidationError, f.clean, None)
     self.assertRaises(ValidationError, f.clean, 'a')
     self.assertRaises(ValidationError, f.clean, 92)
     self.assertRaises(ValidationError, f.clean, -92)
     self.assertEqual(12.345, f.clean(12.345))
     self.assertEqual(-12.345, f.clean(-12.345))
     self.assertEqual(12.345, f.clean('12.345'))
     self.assertIsInstance(f.clean(12.345), latitude)