diff options
author | Paul Harrison <paul@harrison.sh> | 2022-11-18 12:59:18 +0000 |
---|---|---|
committer | Paul Harrison <paul@harrison.sh> | 2022-12-15 16:02:14 +0000 |
commit | 5efd77728dd5a1c6a2fb5070b981ad4d028c3fe1 (patch) | |
tree | 247e31cd5136072964954a00b40a27c0f1968f51 /tests | |
parent | 3899da2f5270d61fa86b090e35f92323c82a5161 (diff) |
feat: Implement auto-naming string enum
Diffstat (limited to 'tests')
-rw-r--r-- | tests/utils/__init__.py | 0 | ||||
-rw-r--r-- | tests/utils/test_enum.py | 16 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/utils/__init__.py diff --git a/tests/utils/test_enum.py b/tests/utils/test_enum.py new file mode 100644 index 0000000..9a84ee1 --- /dev/null +++ b/tests/utils/test_enum.py @@ -0,0 +1,16 @@ +from enum import auto + +from poker.utils.enum import AutoName + + +def test_auto_name() -> None: + class Example(AutoName): + """Example Enum.""" + + foo = auto() + BAR = auto() + WeIrD = auto() + + assert Example.foo.value == "foo" + assert Example.BAR.value == "bar" + assert Example.WeIrD.value == "weird" |