s+,test: implement #25 with accompanying test (#29)

This commit is contained in:
Mark Joshwel 2023-09-07 01:53:35 +08:00 committed by GitHub
parent 6415802f43
commit 412039b568
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View file

@ -862,6 +862,8 @@ def parse_query(behaviour: Behaviour) -> Result[Query]:
split_query = behaviour.query.split(" ") split_query = behaviour.query.split(" ")
for word in split_query: for word in split_query:
word = word.strip(",").strip()
if validator.is_valid(word): if validator.is_valid(word):
portion_plus_code = word portion_plus_code = word

12
test.py
View file

@ -121,6 +121,18 @@ tests: list[ContinuityTest] = [
) )
], ],
), ),
ContinuityTest(
query="8WWJ+4P, Singapore", # a comma!
expected=[
(
"Temasek Polytechnic\n"
"21 Tampines Avenue 1\n"
"Tampines West\n"
"529757\n"
"Northeast, Singapore"
)
],
),
] ]