diff --git a/sqlalchemy_utils/types/choice.py b/sqlalchemy_utils/types/choice.py index cb9be0d..e93fb45 100644 --- a/sqlalchemy_utils/types/choice.py +++ b/sqlalchemy_utils/types/choice.py @@ -141,8 +141,11 @@ class ChoiceType(types.TypeDecorator, ScalarCoercible): def __init__(self, choices, impl=None): self.choices = choices - if Enum is not None and \ - isinstance(choices, type) and issubclass(choices, Enum): + if ( + Enum is not None and + isinstance(choices, type) and + issubclass(choices, Enum) + ): self.type_impl = EnumTypeImpl(enum_class=choices) else: self.type_impl = ChoiceTypeImpl(choices=choices) @@ -199,10 +202,12 @@ class EnumTypeImpl(object): if Enum is None: raise ImproperlyConfigured( "'enum34' package is required to use 'EnumType' in Python " - "< 3.4") + "< 3.4" + ) if not issubclass(enum_class, Enum): raise ImproperlyConfigured( - "EnumType needs a class of enum defined.") + "EnumType needs a class of enum defined." + ) self.enum_class = enum_class diff --git a/tests/types/test_choice.py b/tests/types/test_choice.py index 5badad6..d82177e 100644 --- a/tests/types/test_choice.py +++ b/tests/types/test_choice.py @@ -91,7 +91,8 @@ class TestEnumType(TestCase): id_ = sa.Column(sa.Integer, primary_key=True) status = sa.Column( ChoiceType(OrderStatus, impl=sa.Integer()), - default=OrderStatus.unpaid) + default=OrderStatus.unpaid + ) def __repr__(self): return 'Order(%r, %r)' % (self.id_, self.status)