Beispiel #1
0
 def test_longitude_field(self):
     f = LongitudeField()
     pytest.raises(ValidationError, f.clean, None)
     pytest.raises(ValidationError, f.clean, 'a')
     pytest.raises(ValidationError, f.clean, 182)
     pytest.raises(ValidationError, f.clean, -182)
     assert 123.456 == f.clean(123.456)
     assert -123.456 == f.clean(-123.456)
     assert 123.456 == f.clean('123.456')
     assert isinstance(f.clean(122.456), longitude)
Beispiel #2
0
 def test_longitude_field(self):
     f = LongitudeField()
     self.assertRaises(ValidationError, f.clean, None)
     self.assertRaises(ValidationError, f.clean, 'a')
     self.assertRaises(ValidationError, f.clean, 182)
     self.assertRaises(ValidationError, f.clean, -182)
     self.assertEqual(123.456, f.clean(123.456))
     self.assertEqual(-123.456, f.clean(-123.456))
     self.assertEqual(123.456, f.clean('123.456'))
     self.assertIsInstance(f.clean(122.456), longitude)