1
0
Fork 0
mirror of https://github.com/veekun/pokedex.git synced 2024-08-20 18:16:34 +00:00

Compat with Python 3.3+

This commit is contained in:
Eevee (Alex Munroe) 2015-10-05 08:11:08 -07:00
parent d0e8f503b8
commit b76b74e7a6
15 changed files with 110 additions and 96 deletions

View file

@ -53,7 +53,6 @@ def test_unique_form_order(session):
query = query.options(joinedload('pokemon.species'))
for form in query:
print form.name
try:
previous_species = species_by_form_order[form.order]
except KeyError:

View file

@ -4,6 +4,7 @@ If run directly from the command line, also tests the accessors and the names
of all the media by getting just about everything in a naive brute-force way.
This, of course, takes a lot of time to run.
"""
from __future__ import print_function
import pytest
@ -49,7 +50,6 @@ def test_strict_castform(session, media_root):
with pytest.raises(ValueError):
castform = session.query(tables.PokemonSpecies).filter_by(identifier=u'castform').first()
rainy_castform = [f for f in castform.forms if f.form_identifier == 'rainy'][0]
print rainy_castform
rainy_castform = media.PokemonFormMedia(media_root, rainy_castform)
rainy_castform.overworld('up', strict=True)
@ -81,13 +81,11 @@ def hit(filenames, method, *args, **kwargs):
"""
try:
medium = method(*args, **kwargs)
#print 'Hit', medium.relative_path
assert medium.exists
except ValueError, e:
#print 'DNF', e
except ValueError:
return False
except:
print 'Error while processing', method, args, kwargs
print('Error while processing', method, args, kwargs)
raise
try:
filenames.remove(medium.path)
@ -242,9 +240,9 @@ def test_get_everything(session, media_root):
unaccessed_filenames.remove(filename)
if unaccessed_filenames:
print 'Unaccessed files:'
print('Unaccessed files:')
for filename in unaccessed_filenames:
print filename
print(filename)
assert unaccessed_filenames == set()

View file

@ -38,7 +38,6 @@ def test_class_order():
class_names = [table.__name__ for table in tables.mapped_classes]
def key(name):
return name != 'Language', name
print [(a,b) for (a,b) in zip(class_names, sorted(class_names, key=key)) if a!=b]
assert class_names == sorted(class_names, key=key)
def test_i18n_table_creation():

View file

@ -88,15 +88,15 @@ def test_markdown(session):
assert '10%' in move.effect_map[language].as_text()
assert '10%' in move.effect.as_html()
assert '10%' in move.effect_map[language].as_html()
assert '10%' in unicode(move.effect)
assert '10%' in unicode(move.effect_map[language])
assert '10%' in str(move.effect)
assert '10%' in str(move.effect_map[language])
assert '10%' in move.effect.__html__()
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)
assert unicode(md) == 'Thunderbolt paralyzes Sky Shaymin. mewthree does not exist.'
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>'
class ObjectTestExtension(markdown.PokedexLinkExtension):

View file

@ -112,7 +112,6 @@ def test_merge_translations():
for result, expected in zip(result_stream, expected_list):
res_src, res_crc, res_str, res_match = result
exp_src, exp_match, exp_str = expected
print result, expected
assert res_src.string == exp_src
assert res_str == exp_str, (res_str, exp_str)
if exp_match is None:
@ -122,7 +121,6 @@ def test_merge_translations():
elif exp_match is False:
assert res_crc == translations.crc('----')
assert res_match == exp_match
print 'unused:', unused
for message in unused:
assert message.string == 'unused'
assert message.id == 100