def test_accuracy_missing(self): with pytest.raises(colander.Invalid): RESULT_SCHEMA.deserialize({ 'location': { 'lat': 1.0, 'lng': 1.0 }, 'fallback': 'lacf' })
def test_location_incomplete(self): with pytest.raises(colander.Invalid): RESULT_SCHEMA.deserialize({ 'location': { 'lng': 1.0 }, 'accuracy': 10.0, 'fallback': 'lacf' })
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 })
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 })
def test_empty(self): with pytest.raises(colander.Invalid): RESULT_SCHEMA.deserialize({})
def test_location_missing(self): with pytest.raises(colander.Invalid): RESULT_SCHEMA.deserialize({'accuracy': 10.0, 'fallback': 'lacf'})