Move the rest of pokedex.util.get to pokedex.db.util
[zzz-pokedex.git] / pokedex / tests / test_util.py
index 0fc3b7a..a528d85 100644 (file)
@@ -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]