projects
/
zzz-pokedex.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Crash fix: lookup with empty prefixes.
[zzz-pokedex.git]
/
pokedex
/
tests
/
test_lookup.py
diff --git
a/pokedex/tests/test_lookup.py
b/pokedex/tests/test_lookup.py
index
094e630
..
36f11a1
100644
(file)
--- a/
pokedex/tests/test_lookup.py
+++ b/
pokedex/tests/test_lookup.py
@@
-66,10
+66,12
@@
def test_type_lookup():
assert_equal(results[0].object.__tablename__, 'pokemon',
u'Type restriction works correctly')
assert_equal(len(results), 1, u'Only one id result when type is specified')
assert_equal(results[0].object.__tablename__, 'pokemon',
u'Type restriction works correctly')
assert_equal(len(results), 1, u'Only one id result when type is specified')
- assert_equal(results[0].name, u'Bulbasaur', u'Type + id returns the right result')
+ assert_equal(results[0].object.name, u'Bulbasaur',
+ u'Type + id returns the right result')
results = lookup.lookup(u'1', valid_types=['pokemon'])
results = lookup.lookup(u'1', valid_types=['pokemon'])
- assert_equal(results[0].name, u'Bulbasaur', u'valid_types works as well as type: prefix')
+ assert_equal(results[0].object.name, u'Bulbasaur',
+ u'valid_types works as well as type: prefix')
def test_language_lookup():
# There are two objects named "charge": the move Charge, and the move
def test_language_lookup():
# There are two objects named "charge": the move Charge, and the move
@@
-91,6
+93,10
@@
def test_language_lookup():
assert_equal(results[0].object.name, u'Tackle',
u'Languages and types both work together')
assert_equal(results[0].object.name, u'Tackle',
u'Languages and types both work together')
+ results = lookup.lookup(u'@fr:charge', valid_types=['move'])
+ assert_equal(results[0].object.name, u'Tackle',
+ u'valid_types and language prefixes get along')
+
def test_fuzzy_lookup():
tests = [
# Regular English names
def test_fuzzy_lookup():
tests = [
# Regular English names
@@
-140,3
+146,8
@@
def test_random_lookup():
assert_equal(len(results), 1, u'Constrained random returns one result')
assert_equal(results[0].object.__tablename__, table_name,
u'Constrained random returns result from the right table')
assert_equal(len(results), 1, u'Constrained random returns one result')
assert_equal(results[0].object.__tablename__, table_name,
u'Constrained random returns result from the right table')
+
+def test_crash_empty_prefix():
+ """Searching for ':foo' used to crash, augh!"""
+ results = lookup.lookup(u'Eevee')
+ assert_equal(results[0].object.name, u'Eevee', u'Empty prefix dun crash')