3 from nose
.tools
import *
5 from pokedex
.db
import tables
, connect
7 class TestStrings(object):
9 self
.connection
= connect()
11 def test_filter(self
):
12 q
= self
.connection
.query(tables
.Pokemon
).filter(
13 tables
.Pokemon
.name
== u
"Marowak")
14 assert q
.one().identifier
== 'marowak'
17 # Assuming that the identifiers are just lowercase names
18 q1
= self
.connection
.query(tables
.Pokemon
).filter(
19 tables
.Pokemon
.name
> u
"Xatu").order_by(
21 q2
= self
.connection
.query(tables
.Pokemon
).filter(
22 tables
.Pokemon
.identifier
> u
"xatu").order_by(
24 assert q1
.all() == q2
.all()
26 def test_languages(self
):
27 q
= self
.connection
.query(tables
.Pokemon
).filter(
28 tables
.Pokemon
.name
== u
"Mightyena")
33 ('roomaji', u
'Guraena'),
36 assert pkmn
.names
[lang
] == name
39 def test_bad_lang(self
):
40 q
= self
.connection
.query(tables
.Pokemon
).filter(
41 tables
.Pokemon
.name
== u
"Mightyena")
43 pkmn
.names
["identifier of a language that doesn't exist"]