Ejemplo n.º 1
0
class TestOsm:
    def setup(self):
        self.region = Osm(open('tests/data/osm'))

    def test_import_locations(self):
        assert [str(x) for x in sorted([x for x in self.region
                                        if isinstance(x, Node)],
                                       key=lambda x: x.ident)] == [
            """Node 0 (52°00'56"N, 000°13'18"W) [visible, user: jnrowe, """
            'timestamp: 2008-01-25T12:52:11+00:00]',
            """Node 1 (52°00'56"N, 000°13'18"W) [visible, timestamp: """
            '2008-01-25T12:53:00+00:00, created_by: hand, highway: crossing]',
            """Node 2 (52°00'56"N, 000°13'18"W) [visible, user: jnrowe, """
            'timestamp: 2008-01-25T12:52:30+00:00, amenity: pub]',
        ]

    def test_export_osm_file(self):
        export = self.region.export_osm_file()
        osm_xml = etree.parse('tests/data/osm')
        for e1, e2 in zip(export.getiterator(), osm_xml.getiterator()):
            xml_compare(e1, e2)
Ejemplo n.º 2
0
 def setup(self):
     self.region = Osm(open('tests/data/osm'))