Пример #1
0
 def test_addr_place(self) -> None:
     """Tests the case when addr:place is used."""
     with util.CsvIO(
             open("tests/workdir/street-housenumbers-gh964.csv",
                  "r")) as stream:
         actual = util.get_street_from_housenumber(stream)
     # This is picked up from addr:place because addr:street was empty.
     self.assertEqual(actual, [util.Street(osm_name="Tolvajos tanya")])
Пример #2
0
 def get_osm_streets(self, sorted_result: bool = True) -> List[util.Street]:
     """Reads list of streets for an area from OSM."""
     ret: List[util.Street] = []
     with self.get_files().get_osm_streets_csv_stream() as sock:
         first = True
         for row in sock.get_rows():
             if first:
                 first = False
                 continue
             # 0: @id, 1: name, 6: @type
             street = util.Street(osm_id=int(row[0]), osm_name=row[1])
             if len(row) > 6:
                 street.set_osm_type(row[6])
             street.set_source(_("street"))
             ret.append(street)
     if os.path.exists(self.get_files().get_osm_housenumbers_path()):
         with self.get_files().get_osm_housenumbers_csv_stream() as sock:
             ret += util.get_street_from_housenumber(sock)
     if sorted_result:
         return sorted(set(ret))
     return ret