Code Duplication    Length = 12-13 lines in 2 locations

elodie/tests/geolocation_test.py 2 locations

@@ 125-137 (lines=13) @@
122
    res = geolocation.lookup(lat=55.66333, lon=37.61583)
123
    assert res['address']['city'] == u'\u041d\u0430\u0433\u043e\u0440\u043d\u044b\u0439 \u0440\u0430\u0439\u043e\u043d', res
124
125
@mock.patch('elodie.constants.location_db', '%s/location.json-cached' % gettempdir())
126
def test_place_name_deprecated_string_cached():
127
    # See gh-160 for backwards compatability needed when a string is stored instead of a dict
128
    helper.reset_dbs()
129
    with open('%s/location.json-cached' % gettempdir(), 'w') as f:
130
        f.write("""
131
[{"lat": 37.3667027222222, "long": -122.033383611111, "name": "OLDVALUE"}]
132
"""
133
    )
134
    place_name = geolocation.place_name(37.3667027222222, -122.033383611111)
135
    helper.restore_dbs()
136
137
    assert place_name['city'] == 'Sunnyvale', place_name
138
139
@mock.patch('elodie.constants.location_db', '%s/location.json-cached' % gettempdir())
140
def test_place_name_cached():
@@ 139-150 (lines=12) @@
136
137
    assert place_name['city'] == 'Sunnyvale', place_name
138
139
@mock.patch('elodie.constants.location_db', '%s/location.json-cached' % gettempdir())
140
def test_place_name_cached():
141
    helper.reset_dbs()
142
    with open('%s/location.json-cached' % gettempdir(), 'w') as f:
143
        f.write("""
144
[{"lat": 37.3667027222222, "long": -122.033383611111, "name": {"city": "UNITTEST"}}]
145
"""
146
    )
147
    place_name = geolocation.place_name(37.3667027222222, -122.033383611111)
148
    helper.restore_dbs()
149
150
    assert place_name['city'] == 'UNITTEST', place_name
151
152
def test_place_name_no_default():
153
    # See gh-160 for backwards compatability needed when a string is stored instead of a dict