X-Git-Url: http://git.veekun.com/zzz-pokedex.git/blobdiff_plain/bf31d19cbf28a6ee76ec615e709c6498fbd8e756..d1a237e3f0504c2d2b7a3b357f7a114de1290350:/pokedex/tests/test_lookup.py diff --git a/pokedex/tests/test_lookup.py b/pokedex/tests/test_lookup.py index 703cde9..6479bd6 100644 --- a/pokedex/tests/test_lookup.py +++ b/pokedex/tests/test_lookup.py @@ -102,3 +102,14 @@ def test_wildcard_lookup(): first_result = results[0] assert_equal(first_result.object.name, name, u'Wildcards work correctly') + +def test_random_lookup(): + for _ in xrange(5): + results = pokedex.lookup.lookup(u'random') + assert_equal(len(results), 1, u'Random returns one result') + + for table_name in [u'pokemon', u'moves', u'items', u'abilities', u'types']: + results = pokedex.lookup.lookup(u'random', valid_types=[table_name]) + 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')