Skip to content

Commit

Permalink
feat: adding KeySetType enum
Browse files Browse the repository at this point in the history
  • Loading branch information
eturino committed Jul 28, 2021
1 parent 247996a commit 108e3df
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))*

8 changes: 8 additions & 0 deletions key_set/enum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum


class KeySetType(Enum):
ALL = 'ALL'
ALL_EXCEPT_SOME = 'ALL_EXCEPT_SOME'
NONE = 'NONE'
SOME = 'SOME'
28 changes: 28 additions & 0 deletions tests/test_enum.py
Original file line number Diff line number Diff line change
@@ -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'

0 comments on commit 108e3df

Please sign in to comment.