def dict_with_list():
    assert floatify_latlng({
        'results': [{
            'geom': {
                'lat': "12.01",
                'lng': "-0.9"
            }
        }, {
            'geometry': {
                'lat': '0.1',
                'lng': '10'
            }
        }]
    }) == {
        'results': [{
            'geom': {
                'lat': 12.01,
                'lng': -0.9
            }
        }, {
            'geometry': {
                'lat': 0.1,
                'lng': 10
            }
        }]
    }
def dict_with_stringified_floats():
    assert floatify_latlng({'geom': {
        'lat': "12.01",
        'lng': "-0.9"
    }}) == {
        'geom': {
            'lat': 12.01,
            'lng': -0.9
        }
    }
def test_dict_with_floats():
    assert floatify_latlng({'geom': {
        'lat': 12.01,
        'lng': -0.9
    }}) == {
        'geom': {
            'lat': 12.01,
            'lng': -0.9
        }
    }
Example #4
0
 def test(self):
     self.assertEqual(floatify_latlng(input_value), expected_output)
def test_empty_dict():
    assert floatify_latlng({}) == {}
def list_with_things():
    assert floatify_latlng([{'foo': 'bar'}]) == [{'foo': 'bar'}]
def test_string():
    assert floatify_latlng("123") == "123"
def test_empty_list():
    assert floatify_latlng([]) == []