Пример #1
0
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)
Пример #2
0
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)
Пример #3
0
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))
Пример #4
0
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))
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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))
Пример #8
0
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))
Пример #9
0
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'}
Пример #10
0
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)
Пример #11
0
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'}
Пример #12
0
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)