diff --git a/README.md b/README.md index ea03e19..1594fd5 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,13 @@ Python port of [KeySet in TypeScript](https://github.com/eturino/ts-key-set) and [KeySet in Ruby](https://github.com/eturino/ruby_key_set) TBD + +## `KeySetType` enum + +values + +- `ALL` represents the entirety of possible keys (`𝕌`) +- `NONE` represents an empty set (`∅`) +- `SOME` represents a concrete set (`A ⊂ 𝕌`) +- `ALL_EXCEPT_SOME` represents the complementary of a set, all the elements except the given ones (`A' = {x ∈ 𝕌 | x ∉ A}`) _(see [Complement in Wikipedia](https://en.wikipedia.org/wiki/Complement_set_theory))* + diff --git a/key_set/enum.py b/key_set/enum.py new file mode 100644 index 0000000..c8e9b39 --- /dev/null +++ b/key_set/enum.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class KeySetType(Enum): + ALL = 'ALL' + ALL_EXCEPT_SOME = 'ALL_EXCEPT_SOME' + NONE = 'NONE' + SOME = 'SOME' diff --git a/tests/test_enum.py b/tests/test_enum.py new file mode 100644 index 0000000..b771ada --- /dev/null +++ b/tests/test_enum.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +"""Enum test +Check the enum +""" + +import __future__ # noqa: F401 + +import json # noqa: F401 +from os import path # noqa: F401 +from re import IGNORECASE, sub # noqa: F401 + +import key_set # noqa: F401 +from key_set.enum import KeySetType + + +class TestEnum: # noqa: D101 + + def test_all(self) -> None: + assert KeySetType.ALL.value == 'ALL' + + def test_some(self) -> None: + assert KeySetType.SOME.value == 'SOME' + + def test_none(self) -> None: + assert KeySetType.NONE.value == 'NONE' + + def test_all_except_some(self) -> None: + assert KeySetType.ALL_EXCEPT_SOME.value == 'ALL_EXCEPT_SOME'