def test_partial_delete(): """Deleted relation but nodes are still cached""" t.assert_cached_node(2001) t.assert_cached_way(2001) t.assert_cached_way(2002) assert not t.query_row(t.db_conf, 'osm_landusages', -2001) assert not t.query_row(t.db_conf, 'osm_landusages', 2001)
def test_imported_landusage(): """Multipolygon relation is inserted""" t.assert_cached_node(1001, (13, 47.5)) landusage_1001 = t.query_row(t.db_conf, 'osm_landusages', -1001) # point in polygon assert landusage_1001['geometry'].intersects(t.merc_point(13.4, 47.5)) # hole in multipolygon relation assert not landusage_1001['geometry'].intersects(t.merc_point(14.75, 47.75))
def test_updated_nodes(): """Nodes were added, modified or deleted""" t.assert_missing_node(10000) t.assert_cached_node(10001, (10.0, 40.0)) t.assert_cached_node(10002, (10.1, 40.0)) place_10001 = t.query_row(t.db_conf, 'osm_places', 10001) assert place_10001['name'] == 'Bar', place_10001 place_10002 = t.query_row(t.db_conf, 'osm_places', 10002) assert place_10002['name'] == 'Baz', place_10002
def test_updated_landusage(): """Multipolygon relation was modified""" t.assert_cached_node(1001, (13.5, 47.5)) landusage_1001 = t.query_row(t.db_conf, 'osm_landusages', -1001) # point not in polygon after update assert not landusage_1001['geometry'].intersects(t.merc_point(13.4, 47.5))
def test_mapped_node(): """Node is stored with all tags.""" t.assert_cached_node(10002, (11, 42)) poi = t.query_row(t.db_conf, 'osm_all', 10002) assert poi['tags'] == {'random': 'tag', 'but': 'mapped', 'poi': 'unicorn'}
def test_non_mapped_node_is_missing(): """Node without mapped tags is missing.""" t.assert_cached_node(10001, (10, 42)) assert not t.query_row(t.db_conf, 'osm_all', 10001)