Squash a bunch of "non-unicode bind param" warnings

This commit is contained in:
Andrew Ekstedt 2018-03-30 12:14:55 -07:00
parent e1bbe78b72
commit 56cf0fd29d
2 changed files with 14 additions and 14 deletions

View file

@ -20,10 +20,10 @@ def test_languages(session):
tables.PokemonSpecies.name == u"Mightyena")
pkmn = q.one()
for lang, name in (
('en', u'Mightyena'),
('ja-Hrkt', u'グラエナ'),
('roomaji', u'Guraena'),
('fr', u'Grahyèna'),
(u'en', u'Mightyena'),
(u'ja-Hrkt', u'グラエナ'),
(u'roomaji', u'Guraena'),
(u'fr', u'Grahyèna'),
):
language = session.query(tables.Language).filter_by(
identifier=lang).one()
@ -92,8 +92,8 @@ def test_markdown(session):
assert '10%' in move.effect_map[language].__html__()
def test_markdown_string(session):
en = util.get(session, tables.Language, 'en')
md = markdown.MarkdownString('[]{move:thunderbolt} [paralyzes]{mechanic:paralysis} []{form:sky shaymin}. []{pokemon:mewthree} does not exist.', session, en)
en = util.get(session, tables.Language, u'en')
md = markdown.MarkdownString(u'[]{move:thunderbolt} [paralyzes]{mechanic:paralysis} []{form:sky shaymin}. []{pokemon:mewthree} does not exist.', session, en)
assert str(md) == 'Thunderbolt paralyzes Sky Shaymin. mewthree does not exist.'
assert md.as_html() == '<p><span>Thunderbolt</span> <span>paralyzes</span> <span>Sky Shaymin</span>. <span>mewthree</span> does not exist.</p>'

View file

@ -6,35 +6,35 @@ parametrize = pytest.mark.parametrize
from pokedex.db import tables, util
def test_get_item_identifier(session):
item = util.get(session, tables.Item, identifier='master-ball')
item = util.get(session, tables.Item, identifier=u'master-ball')
assert item.name == 'Master Ball'
def test_get_item_name(session):
item = util.get(session, tables.Item, name='Awakening')
item = util.get(session, tables.Item, name=u'Awakening')
assert item.name == 'Awakening'
def test_get_english_by_identifier(session):
language = util.get(session, tables.Language, 'en')
language = util.get(session, tables.Language, u'en')
assert language.name == 'English'
@parametrize('identifier', ['burmy', 'shaymin', 'unown', 'cresselia'])
@parametrize('identifier', [u'burmy', u'shaymin', u'unown', u'cresselia'])
def test_get_pokemon_identifier(session, identifier):
poke = util.get(session, tables.PokemonSpecies, identifier=identifier)
assert poke.identifier == identifier
@parametrize('name', ['Burmy', 'Shaymin', 'Unown', 'Cresselia'])
@parametrize('name', [u'Burmy', u'Shaymin', u'Unown', u'Cresselia'])
def test_get_pokemon_name(session, name):
poke = util.get(session, tables.PokemonSpecies, name=name)
assert poke.name == name
@parametrize('name', ['Cheniti', 'Shaymin', 'Zarbi', 'Cresselia'])
@parametrize('name', [u'Cheniti', u'Shaymin', u'Zarbi', u'Cresselia'])
def test_get_pokemon_name_explicit_language(session, name):
french = util.get(session, tables.Language, 'fr')
french = util.get(session, tables.Language, u'fr')
poke = util.get(session, tables.PokemonSpecies, name=name, language=french)
assert poke.name_map[french] == name, poke.name_map[french]
def test_types_french_order(session):
french = util.get(session, tables.Language, 'fr')
french = util.get(session, tables.Language, u'fr')
types = session.query(tables.Type).filter(tables.Type.id < 10000)
types = list(util.order_by_name(types, tables.Type, language=french))
assert types[0].name_map[french] == 'Acier', types[0].name_map[french]