From: Petr Viktorin Date: Thu, 14 Apr 2011 17:08:05 +0000 (+0300) Subject: Move the rest of pokedex.util.get to pokedex.db.util X-Git-Url: http://git.veekun.com/zzz-pokedex.git/commitdiff_plain/022bbf854bfd867bc2868a5c0c8e8383deacbdd0 Move the rest of pokedex.util.get to pokedex.db.util --- diff --git a/pokedex/util/get.py b/pokedex/db/util.py similarity index 100% rename from pokedex/util/get.py rename to pokedex/db/util.py diff --git a/pokedex/tests/test_util.py b/pokedex/tests/test_util.py index 0fc3b7a..a528d85 100644 --- a/pokedex/tests/test_util.py +++ b/pokedex/tests/test_util.py @@ -2,54 +2,54 @@ from nose.tools import * import unittest -from pokedex.db import connect, tables -from pokedex.util import get, simple +from pokedex.db import connect, tables, util +from pokedex.util import simple session = connect() def test_get_item_identifier(): - item = get.get(session, tables.Item, identifier='master-ball') + item = util.get(session, tables.Item, identifier='master-ball') assert item.name == 'Master Ball' def test_get_item_name(): - item = get.get(session, tables.Item, name='Awakening') + item = util.get(session, tables.Item, name='Awakening') assert item.name == 'Awakening' def test_get_english_by_identifier(): - language = get.get(session, tables.Language, 'en') + language = util.get(session, tables.Language, 'en') assert language.name == 'English' def test_get_pokemon_baseform_identifier(): for identifier in 'burmy shaymin unown cresselia'.split(): - poke = get.get(session, tables.Pokemon, identifier=identifier) + poke = util.get(session, tables.Pokemon, identifier=identifier) assert poke.identifier == identifier assert poke.is_base_form def test_get_pokemon_baseform_name(): for name in 'Burmy Shaymin Unown Cresselia'.split(): - poke = get.get(session, tables.Pokemon, name=name) + poke = util.get(session, tables.Pokemon, name=name) assert poke.name == name assert poke.is_base_form def test_get_pokemon_baseform_name_explicit_language(): - french = get.get(session, tables.Language, 'fr') + french = util.get(session, tables.Language, 'fr') for name in 'Cheniti Shaymin Zarbi Cresselia'.split(): - poke = get.get(session, tables.Pokemon, name=name, language=french) + poke = util.get(session, tables.Pokemon, name=name, language=french) assert poke.name_map[french] == name, poke.name_map[french] assert poke.is_base_form def test_get_pokemon_other_form_identifier(): for ii in 'wormadam/trash shaymin/sky shaymin/land'.split(): pokemon_identifier, form_identifier = ii.split('/') - poke = get.get(session, tables.Pokemon, identifier=pokemon_identifier, form_identifier=form_identifier) + poke = util.get(session, tables.Pokemon, identifier=pokemon_identifier, form_identifier=form_identifier) assert poke.identifier == pokemon_identifier if poke.form.unique_pokemon_id: assert poke.form.identifier == form_identifier def test_types_french_order(): - french = get.get(session, tables.Language, 'fr') + french = util.get(session, tables.Language, 'fr') types = session.query(tables.Type).filter(tables.Type.id < 10000) - types = list(get.order_by_name(types, tables.Type, language=french)) + types = list(util.order_by_name(types, tables.Type, language=french)) assert types[0].name_map[french] == 'Acier', types[0].name_map[french] assert types[-1].name_map[french] == 'Vol', types[-1].name_map[french] diff --git a/pokedex/util/simple.py b/pokedex/util/simple.py index 46806f7..d801f2b 100644 --- a/pokedex/util/simple.py +++ b/pokedex/util/simple.py @@ -12,7 +12,7 @@ of what to watch out for. """ from pokedex.db import tables -from pokedex.util.get import filter_base_forms, order_by_name +from pokedex.db.util import filter_base_forms, order_by_name def pokemon(session): """Get a "sane" list of pokemon