mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Fix test for missing default forms
This commit is contained in:
parent
a91a7d95b3
commit
de27f2c282
1 changed files with 3 additions and 4 deletions
|
@ -110,8 +110,8 @@ def test_default_forms(session):
|
||||||
default pokemon."""
|
default pokemon."""
|
||||||
|
|
||||||
q = session.query(tables.Pokemon)
|
q = session.query(tables.Pokemon)
|
||||||
q = q.join(tables.PokemonForm)
|
# TODO: could use table.Pokemon.forms.and_: https://docs.sqlalchemy.org/en/14/orm/queryguide.html#orm-queryguide-join-on-augmented
|
||||||
q = q.filter(tables.PokemonForm.is_default==True)
|
q = q.outerjoin(tables.PokemonForm, (tables.PokemonForm.pokemon_id == tables.Pokemon.id) & (tables.PokemonForm.is_default==True))
|
||||||
q = q.options(lazyload('*'))
|
q = q.options(lazyload('*'))
|
||||||
q = q.group_by(tables.Pokemon)
|
q = q.group_by(tables.Pokemon)
|
||||||
q = q.add_columns(func.count(tables.PokemonForm.id))
|
q = q.add_columns(func.count(tables.PokemonForm.id))
|
||||||
|
@ -123,8 +123,7 @@ def test_default_forms(session):
|
||||||
pytest.fail("pokemon %s has %d default forms" % (pokemon.name, num_default_forms))
|
pytest.fail("pokemon %s has %d default forms" % (pokemon.name, num_default_forms))
|
||||||
|
|
||||||
q = session.query(tables.PokemonSpecies)
|
q = session.query(tables.PokemonSpecies)
|
||||||
q = q.join(tables.Pokemon)
|
q = q.outerjoin(tables.Pokemon, (tables.Pokemon.species_id == tables.PokemonSpecies.id) & (tables.Pokemon.is_default==True))
|
||||||
q = q.filter(tables.Pokemon.is_default==True)
|
|
||||||
q = q.options(lazyload('*'))
|
q = q.options(lazyload('*'))
|
||||||
q = q.group_by(tables.PokemonSpecies)
|
q = q.group_by(tables.PokemonSpecies)
|
||||||
q = q.add_columns(func.count(tables.Pokemon.id))
|
q = q.add_columns(func.count(tables.Pokemon.id))
|
||||||
|
|
Loading…
Reference in a new issue