コード例 #1
0
def test_monoid_law_right_identity(m):
    # a + mempty = a
    assert tc.mappend(m, tc.mempty(m)) == m
コード例 #2
0
ファイル: test_maybe.py プロジェクト: yetone/python-lenses
def test_Just_add_monoid_empty():
    obj = object()
    value = Just(obj)
    assert value + mempty(value) == value
コード例 #3
0
def test_monoid_law_left_identity(m):
    # mempty + a = a
    assert tc.mappend(tc.mempty(m), m) == m
コード例 #4
0
def test_monoid_law_right_identity(monoids):
    # a + mempty = a
    monoid = monoids[0]
    assert tc.mappend(monoid, tc.mempty(monoid)) == monoid
コード例 #5
0
def test_monoid_law_left_identity(monoids):
    # mempty + a = a
    monoid = monoids[0]
    assert tc.mappend(tc.mempty(monoid), monoid) == monoid
コード例 #6
0
def test_monoid_law_left_identity(monoids):
    # mempty + a = a
    monoid = monoids[0]
    assert tc.mappend(tc.mempty(monoid), monoid) == monoid
コード例 #7
0
def test_monoid_law_right_identity(monoids):
    # a + mempty = a
    monoid = monoids[0]
    assert tc.mappend(monoid, tc.mempty(monoid)) == monoid