forked from davidmcclure/litecoder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it possible to pass bare name blocklist to USCityIndex.
- Loading branch information
1 parent
37c99bb
commit c26b9a9
Showing
2 changed files
with
48 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
|
||
import pytest | ||
|
||
from litecoder.usa import USCityIndex | ||
|
||
|
||
def test_bare_name_bloclist(): | ||
"""Blocklisted bare names should be omitted from index. | ||
""" | ||
idx = USCityIndex(bare_name_blocklist=['Washington', 'New York']) | ||
idx.build() | ||
|
||
blocked = ( | ||
'Washington', | ||
'washington', | ||
'Washington, USA', | ||
'New York', | ||
'new york', | ||
'New York, USA' | ||
) | ||
|
||
for query in blocked: | ||
assert not idx[query] | ||
|
||
assert idx['Washington DC'][0].data.wof_id == 85931779 | ||
assert idx['New York, NY'][0].data.wof_id == 85977539 |