diff options
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/test_monads.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/unit/test_monads.py b/tests/unit/test_monads.py new file mode 100644 index 0000000..9ae07be --- /dev/null +++ b/tests/unit/test_monads.py @@ -0,0 +1,23 @@ +"""Test cases for functions defined in monads.py""" +import pytest + +from pymonad.maybe import Just, Nothing +from gn3.monads import MonadicDict + + +@pytest.mark.unit_test +@pytest.mark.parametrize( + ("key", "value", "expected"), + ( + ("foo", Just(1), Just(1)), + ("bar", Nothing, Nothing), + ), +) +def test_monadic_dict(key, value, expected): + """Test basic Monadic Dict operations""" + _test_dict = MonadicDict() + _test_dict[key] = value + _test_dict |= {"test_update": "random"} + assert _test_dict[key] == expected + assert _test_dict["test_update"] == Just("random") + assert _test_dict["non-existent"] == Nothing |