mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Move the rest of pokedex.util.get to pokedex.db.util
This commit is contained in:
parent
f271812cf7
commit
69140a88f5
3 changed files with 13 additions and 13 deletions
|
@ -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]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue