mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Wildcard lookup! #89
Test suite no longer reloads the entire database. Takes too long. Factored out some magic numbers in lookup().
This commit is contained in:
parent
11989d0db2
commit
9e3d8b317d
3 changed files with 27 additions and 9 deletions
pokedex/tests
|
@ -89,3 +89,16 @@ def test_fuzzy_lookup():
|
|||
top_names = [_.object.name for _ in results[0:2]]
|
||||
assert_true(u'Nidoran♂' in top_names, u'Nidoran♂ is a top result for "Nidoran"')
|
||||
assert_true(u'Nidoran♀' in top_names, u'Nidoran♀ is a top result for "Nidoran"')
|
||||
|
||||
def test_wildcard_lookup():
|
||||
tests = [
|
||||
(u'pokemon:*meleon', u'Charmeleon'),
|
||||
(u'item:master*', u'Master Ball'),
|
||||
(u'ee?ee', u'Eevee'),
|
||||
]
|
||||
|
||||
for wildcard, name in tests:
|
||||
results = pokedex.lookup.lookup(wildcard)
|
||||
first_result = results[0]
|
||||
assert_equal(first_result.object.name, name,
|
||||
u'Wildcards work correctly')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue