Fix failing tests.

This commit is contained in:
Andrew Ekstedt 2015-05-25 22:16:22 -07:00
parent 455174f19d
commit 9d7cc07836
2 changed files with 4 additions and 4 deletions

View File

@ -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 = []

View File

@ -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():