mirror of
https://github.com/correl/typesafe-monads.git
synced 2024-11-14 19:19:32 +00:00
Docs and tests
This commit is contained in:
parent
9869a5cd49
commit
52819c3507
2 changed files with 4 additions and 1 deletions
|
@ -147,6 +147,9 @@ value if the list is empty.
|
|||
|
||||
## Monads
|
||||
|
||||
Wrapped values should be immutable: they are _protected_ from accidental direct writing with *Final* type and the pythonic naming convention.
|
||||
|
||||
|
||||
### Maybe[T]
|
||||
|
||||
Represents optional data. A `Maybe` instance of a certain type `T` will
|
||||
|
|
|
@ -59,7 +59,7 @@ def test_mconcat(constructor: Constructor) -> None:
|
|||
|
||||
def test_immutability(constructor: Constructor) -> None:
|
||||
a: Monoid = construct(constructor, 1)
|
||||
assert a.value == 1
|
||||
assert a.value != None
|
||||
with pytest.raises(AttributeError) as excinfo:
|
||||
# this is ignore on porpouse othewise the mypy test fail. Uncomment to check the Final check with mypy
|
||||
a.value = 2 # type: ignore
|
||||
|
|
Loading…
Reference in a new issue