mirror of
https://codeberg.org/matkoniecz/list_how_openstreetmap_can_be_improved_with_alltheplaces_data.git
synced 2025-05-13 05:03:09 +02:00
smarter handling of lifecycle prefixes
This commit is contained in:
parent
db88fea6a0
commit
f6077cca8b
2 changed files with 15 additions and 2 deletions
10
0_config.py
10
0_config.py
|
@ -4883,7 +4883,7 @@ def canonical_feature(object_tags):
|
|||
return "parcel_locker"
|
||||
if "shop" in object_tags:
|
||||
if object_tags["shop"] in tag_knowledge.valid_shop_values():
|
||||
if object_tags["shop"] != "yes":
|
||||
if object_tags["shop"] not in ["yes", "vacant"]: # prefer other active values if present at all
|
||||
return "shop=" + object_tags["shop"]
|
||||
if "craft" in object_tags:
|
||||
if object_tags["craft"] in tag_knowledge.valid_craft_values():
|
||||
|
@ -4891,9 +4891,15 @@ def canonical_feature(object_tags):
|
|||
if "office" in object_tags:
|
||||
if object_tags["office"] in tag_knowledge.valid_office_values():
|
||||
return "office=" + object_tags["office"]
|
||||
substandard = None
|
||||
for main_key in tag_knowledge.typical_main_keys():
|
||||
if main_key in object_tags:
|
||||
return main_key + "=" + object_tags[main_key]
|
||||
if object_tags[main_key] in ["yes", "vacant"]:
|
||||
substandard = main_key + "=" + object_tags[main_key]
|
||||
else:
|
||||
return main_key + "=" + object_tags[main_key]
|
||||
if substandard != None:
|
||||
return substandard
|
||||
return "?"
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import serializing
|
||||
import unittest
|
||||
import matcher
|
||||
import osm_bot_abstraction_layer.tag_knowledge as tag_knowledge
|
||||
config = __import__("0_config")
|
||||
|
||||
|
||||
|
@ -562,6 +563,12 @@ class CanonicalValueTests(unittest.TestCase):
|
|||
|
||||
def test_disused_shop_is_not_shadowing_active_leisure(self):
|
||||
self.assertEqual(config.the_same_feature_type({'leisure': 'fitness_centre'}, {'leisure': 'fitness_centre', 'disused:shop': 'furniture'}), True)
|
||||
for prefix in tag_knowledge.typical_lifecycle_prefixes_for_past():
|
||||
self.assertEqual(config.the_same_feature_type({'leisure': 'fitness_centre'}, {'leisure': 'fitness_centre', prefix + 'shop': 'furniture'}), True)
|
||||
|
||||
def test_main_tags_list_active_construction_before_vacant_shop(self):
|
||||
self.assertEqual(config.the_same_feature_type({'construction:leisure': 'fitness_centre'}, {'construction:leisure': 'fitness_centre', 'shop': 'vacant'}), True)
|
||||
self.assertEqual(config.the_same_feature_type({'construction:leisure': 'fitness_centre'}, {'construction:leisure': 'fitness_centre', 'disused:shop': 'furniture'}), True)
|
||||
|
||||
class TestSupportFunctions(unittest.TestCase):
|
||||
def test_null_island_is_not_in_poland(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue