예제 #1
0
def test_by_key(xml_file):
    tags = pythonify.Tags(xml_file)
    assert( lists_agree_up_to_ordering(tags.nodes_from_key("name"), [("bob", 1), ("dave", 2)]) )
    assert( tags.nodes_from_key("highway") == [] )
    assert( lists_agree_up_to_ordering(tags.ways_from_key("highway"), [("unclassified", 1), ("road", 2)]) )
    assert( lists_agree_up_to_ordering(tags.relations_from_key("route"), [("bus", 1), ("bus", 2)]) )
    assert( lists_agree_up_to_ordering(tags.relations_from_key("name"), [("64", 1), ("68", 2)]) )
예제 #2
0
def test_by_key_pair(xml_file):
    tags = pythonify.Tags(xml_file)
    assert( tags.nodes(("a", "b")) == [] )
    assert( tags.nodes(("traffic_sign", "city_limit")) == [1] )
    assert( tags.nodes(("route", "bus")) == [] )
    
    assert( tags.ways(("a", "b")) == [] )
    assert( tags.ways(("highway", "unclassified")) == [1] )
    assert( tags.ways(("route", "bus")) == [] )
    
    assert( tags.relations(("a", "b")) == [] )
    assert( tags.relations(("highway", "unclassified")) == [] )
    assert( lists_agree_up_to_ordering(tags.relations(("route", "bus")), [1, 2]) )
예제 #3
0
def test_from_key_value(xml_file):
    tags = pythonify.Tags(xml_file)
    assert( tags.from_key_value("name", "bob") == [("node", 1)] )
    assert( lists_agree_up_to_ordering(tags.from_key_value("route", "bus"), [("relation", 1), ("relation", 2)]) )
예제 #4
0
def tags(xml_file):
    yield pythonify.Tags(xml_file)
예제 #5
0
def test_from_key(xml_file):
    tags = pythonify.Tags(xml_file)
    assert( lists_agree_up_to_ordering(tags.from_key("name"), [("node", "bob", 1), ("node", "dave", 2),
           ("relation", "64", 1), ("relation", "68", 2)]) )
    assert( lists_agree_up_to_ordering(tags.from_key("highway"),
        [("way", "unclassified", 1), ("way", "road", 2)]) )