Open willidert opened 4 years ago
Thanks @willidert . We could add optional validation via the query_postal_code(..., validate=True
) parameter, however it would need to be extensively tested to pass on all postal codes in the DB and fail on a few counter examples (see test_pgeocode.py
for examples of test).
For now this is a 1 file package (pgeocode.py
) with test_pgeocode.py
for unit tests. So this PR should only change these two files.
To fix merge conflicts please use back see https://github.com/symerio/pgeocode/blob/master/doc/contributing.rst#code-style for more details.
Also if we want to do this check, the mechanism needs to be generic enough so it can be easily extended to other countries. Maybe something like,
class _CheckPostalCode:
def __init__(self, country):
self.country = country
def __call__(self, postal_code):
if self.country == "BR":
...
else:
raise NotImplementedError
hi @rth , i've been a little busy, sorry. I'll make the changes. Thank you very much for the suggestions and support.
Sorry, i have problems with github actions.
Thx for the opportunity, I hope it helped. I had a little difficulty in the tests. I'm sorry if something is strange. I am available for any correction.
The geonames does not work for all CEPs in Brazil. I added a function that checks if the zip code is valid for geonames.
Closes https://github.com/symerio/pgeocode/issues/30