Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when a changeset has an empty host value #66

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion osmcha/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# osmcha
__version__ = '0.9.0'
__version__ = '0.9.1'
5 changes: 4 additions & 1 deletion osmcha/changeset.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,5 +420,8 @@ def get_dict(self):
ch_dict.pop(key)

for field in FIELDS_TO_REMOVE:
ch_dict.pop(field)
try:
ch_dict.pop(field)
except KeyError:
pass
return ch_dict
22 changes: 21 additions & 1 deletion tests/test_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ def test_analyse_verify_editor_id_osm():
assert ch.suspicion_reasons == []



def test_verify_editor_id_is_known_instance():
"""Test if iD is not a powerfull_editor and if 'Unknown iD instance' is added
to suspicion_reasons.
Expand Down Expand Up @@ -904,6 +903,27 @@ def test_changeset_with_warning_tag_invalid_format():
assert not changeset.is_suspect


def get_dict_doesnt_fail_with_empty_host_value():
ch_dict = {
'created_by': 'iD',
'created_at': '2019-04-25T18:08:46Z',
'host': '',
'comment': 'add pois',
'id': '1',
'user': 'JustTest',
'uid': '123123',
'bbox': Polygon([
(-71.0646843, 44.2371354), (-71.0048652, 44.2371354),
(-71.0048652, 44.2430624), (-71.0646843, 44.2430624),
(-71.0646843, 44.2371354)
])
}
changeset = Analyse(ch_dict)
changeset.full_analysis()
processed_dict = changeset.get_dict()
assert 'host' not in processed_dict.keys()


def test_enabled_warnings():
warnings = Warnings()
assert warnings.get_non_exact_match_warnings() == [
Expand Down
Loading