Example #1
0
 def test_accuracy_missing(self):
     with pytest.raises(colander.Invalid):
         RESULT_SCHEMA.deserialize({
             'location': {
                 'lat': 1.0,
                 'lng': 1.0
             },
             'fallback': 'lacf'
         })
Example #2
0
 def test_location_incomplete(self):
     with pytest.raises(colander.Invalid):
         RESULT_SCHEMA.deserialize({
             'location': {
                 'lng': 1.0
             },
             'accuracy': 10.0,
             'fallback': 'lacf'
         })
Example #3
0
 def test_accuracy_float(self):
     data = RESULT_SCHEMA.deserialize({
         'location': {
             'lat': 1.0,
             'lng': 1.0
         },
         'accuracy': 11.6
     })
     assert (data == {
         'lat': 1.0,
         'lon': 1.0,
         'accuracy': 11.6,
         'fallback': None
     })
Example #4
0
 def test_fallback_missing(self):
     data = RESULT_SCHEMA.deserialize({
         'location': {
             'lat': 1.0,
             'lng': 1.0
         },
         'accuracy': 10.0
     })
     assert (data == {
         'lat': 1.0,
         'lon': 1.0,
         'accuracy': 10.0,
         'fallback': None
     })
Example #5
0
 def test_empty(self):
     with pytest.raises(colander.Invalid):
         RESULT_SCHEMA.deserialize({})
Example #6
0
 def test_location_missing(self):
     with pytest.raises(colander.Invalid):
         RESULT_SCHEMA.deserialize({'accuracy': 10.0, 'fallback': 'lacf'})