From 9d7cc078361833cb58b5f6328ff9b457b6863058 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Mon, 25 May 2015 22:16:22 -0700 Subject: [PATCH] Fix failing tests. --- pokedex/db/tables.py | 2 +- pokedex/tests/test_schema.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pokedex/db/tables.py b/pokedex/db/tables.py index 84f1a0c..09edb04 100644 --- a/pokedex/db/tables.py +++ b/pokedex/db/tables.py @@ -73,7 +73,7 @@ mapped_classes = [] class TableMetaclass(DeclarativeMeta): def __init__(cls, name, bases, attrs): super(TableMetaclass, cls).__init__(name, bases, attrs) - if hasattr(cls, '__tablename__'): + if hasattr(cls, '__tablename__') or hasattr(cls, '__table__'): mapped_classes.append(cls) cls.translation_classes = [] diff --git a/pokedex/tests/test_schema.py b/pokedex/tests/test_schema.py index 2288ac9..0cb105d 100644 --- a/pokedex/tests/test_schema.py +++ b/pokedex/tests/test_schema.py @@ -33,12 +33,12 @@ def test_variable_names_2(table): def test_class_order(): """The declarative classes should be defined in alphabetical order. - Except for Language which should be first. + Except for Language and VersionGroup which should be first. """ 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] + return name not in ('Language', 'VersionGroup'), name + print "Unordered pairs:", [(a,b) for (a,b) in zip(class_names, class_names[1:]) if key(a)>key(b)] assert class_names == sorted(class_names, key=key) def test_i18n_table_creation():