-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Move enums into non-nested classes
Refs #57
- Loading branch information
Showing
6 changed files
with
103 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# coding=utf-8 | ||
from __future__ import unicode_literals | ||
from django.utils.translation import ugettext_lazy | ||
|
||
from enumfields import Enum, IntEnum | ||
|
||
|
||
class Color(Enum): | ||
__order__ = 'RED GREEN BLUE' | ||
|
||
RED = 'r' | ||
GREEN = 'g' | ||
BLUE = 'b' | ||
|
||
class Labels: | ||
RED = 'Reddish' | ||
BLUE = ugettext_lazy('bluë') | ||
|
||
|
||
class Taste(Enum): | ||
SWEET = 1 | ||
SOUR = 2 | ||
BITTER = 3 | ||
SALTY = 4 | ||
UMAMI = 5 | ||
|
||
|
||
class ZeroEnum(Enum): | ||
ZERO = 0 | ||
ONE = 1 | ||
|
||
|
||
class IntegerEnum(IntEnum): | ||
A = 0 | ||
B = 1 | ||
|
||
class Labels: | ||
A = 'foo' | ||
|
||
|
||
class LabeledEnum(Enum): | ||
FOO = 'foo' | ||
BAR = 'bar' | ||
FOOBAR = 'foobar' | ||
|
||
class Labels: | ||
FOO = 'Foo' | ||
BAR = 'Bar' | ||
# this is intentional. see test_nonunique_label | ||
FOOBAR = 'Foo' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters