Skip to content

Commit

Permalink
kwu_de match street with == intead of in
Browse files Browse the repository at this point in the history
this fixes a problem where street Im Feldweg is selected when searching for the street Feldweg
  • Loading branch information
5ila5 committed Jul 16, 2024
1 parent a8c6e14 commit a3b7a8f
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
TEST_CASES = {
"Erkner": {"city": "Erkner", "street": "Heinrich-Heine-Straße", "number": "11"},
"Bad Saarow": {"city": "Bad Saarow", "street": "Ahornallee", "number": 1},
"Spreenhagen Feldweg 4": {"city": "Spreenhagen", "street": "Feldweg", "number": 4},
}

HEADERS = {"user-agent": "Mozilla/5.0 (xxxx Windows NT 10.0; Win64; x64)"}
Expand All @@ -25,8 +26,8 @@
class Source:
def __init__(self, city, street, number):
self._city = city
self._street = street
self._number = str(number)
self._street = street.strip().lower()
self._number = str(number).lower().strip()
self._ics = ICS()

def fetch(self):
Expand Down Expand Up @@ -61,7 +62,7 @@ def fetch(self):

StrasseValue = None
for Strasse in Strassen:
if self._street in Strasse.text:
if self._street == Strasse.text.strip().lower():
StrasseValue = Strasse["value"]
break
if StrasseValue is None:
Expand All @@ -81,7 +82,7 @@ def fetch(self):

ObjektValue = None
for obj in objects:
if self._number in obj.text:
if self._number == obj.text.lower().strip():
ObjektValue = obj["value"]
break
if ObjektValue is None:
Expand Down

0 comments on commit a3b7a8f

Please sign in to comment.