Fairy Arceus is not a default form.

This commit is contained in:
Andrew Ekstedt 2013-10-29 02:54:36 -07:00
parent b412bfaa8e
commit ec5dd5177f
2 changed files with 35 additions and 2 deletions

View file

@ -801,7 +801,7 @@ id,identifier,form_identifier,pokemon_id,introduced_in_version_group_id,is_defau
10082,kyurem-black,black,10022,14,1,0,0,2,736 10082,kyurem-black,black,10022,14,1,0,0,2,736
10083,kyurem-white,white,10023,14,1,0,0,3,737 10083,kyurem-white,white,10023,14,1,0,0,3,737
10084,keldeo-resolute,resolute,10024,14,1,0,0,2,739 10084,keldeo-resolute,resolute,10024,14,1,0,0,2,739
10085,arceus-fairy,fairy,493,15,1,0,0,2,570 10085,arceus-fairy,fairy,493,15,0,0,0,2,570
10086,vivillon-icy-snow,icy-snow,666,15,0,0,0,1,760 10086,vivillon-icy-snow,icy-snow,666,15,0,0,0,1,760
10087,vivillon-polar,polar,666,15,0,0,0,2,761 10087,vivillon-polar,polar,666,15,0,0,0,2,761
10088,vivillon-tundra,tundra,666,15,0,0,0,3,762 10088,vivillon-tundra,tundra,666,15,0,0,0,3,762

1 id identifier form_identifier pokemon_id introduced_in_version_group_id is_default is_battle_only is_mega form_order order
801 10082 kyurem-black black 10022 14 1 0 0 2 736
802 10083 kyurem-white white 10023 14 1 0 0 3 737
803 10084 keldeo-resolute resolute 10024 14 1 0 0 2 739
804 10085 arceus-fairy fairy 493 15 1 0 0 0 2 570
805 10086 vivillon-icy-snow icy-snow 666 15 0 0 0 1 760
806 10087 vivillon-polar polar 666 15 0 0 0 2 761
807 10088 vivillon-tundra tundra 666 15 0 0 0 3 762

View file

@ -1,8 +1,9 @@
import pytest import pytest
from sqlalchemy.orm import aliased, joinedload from sqlalchemy.orm import aliased, joinedload, lazyload
from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.sql import func
from pokedex.db import connect, tables, util from pokedex.db import connect, tables, util
@ -64,3 +65,35 @@ def test_unique_form_order():
form.order, form.order,
species_by_form_order[form.order].name, species_by_form_order[form.order].name,
form.species.name)) form.species.name))
def test_default_forms():
"""Check that each pokemon has one default form and each species has one
default pokemon."""
session = connect()
q = session.query(tables.Pokemon)
q = q.join(tables.PokemonForm)
q = q.filter(tables.PokemonForm.is_default==True)
q = q.options(lazyload('*'))
q = q.group_by(tables.Pokemon)
q = q.add_columns(func.count(tables.PokemonForm.id))
for pokemon, num_default_forms in q:
if num_default_forms == 0:
raise AssertionError("pokemon %s has no default forms" % pokemon.name)
elif num_default_forms > 1:
raise AssertionError("pokemon %s has %d default forms" % (pokemon.name, num_default_forms))
q = session.query(tables.PokemonSpecies)
q = q.join(tables.Pokemon)
q = q.filter(tables.Pokemon.is_default==True)
q = q.options(lazyload('*'))
q = q.group_by(tables.PokemonSpecies)
q = q.add_columns(func.count(tables.Pokemon.id))
for species, num_default_pokemon in q:
if num_default_pokemon == 0:
raise AssertionError("species %s has no default pokemon" % species.name)
elif num_default_pokemon > 1:
raise AssertionError("species %s has %d default pokemon" % (species.name, num_default_pokemon))