Beispiel #1
0
def test_Just_iter():
    obj = object()
    assert list(Just(obj)) == [obj]
Beispiel #2
0
def test_Just_add_monoid_empty():
    obj = object()
    value = Just(obj)
    assert value + mempty(value) == value
Beispiel #3
0
def test_Just_repr_conatins_subobject():
    obj = object()
    assert repr(obj) in repr(Just(obj))
Beispiel #4
0
def test_Just_add_Nothing():
    obj = object()
    assert Just(obj) + Nothing() == Just(obj)
Beispiel #5
0
def test_Just_add_Just():
    assert Just([1]) + Just([2]) == Just([1, 2])
Beispiel #6
0
def test_IsomorphismLens_unpack():
    assert b.Isomorphism(int, str).unpack('1') == Just(1)
Beispiel #7
0
def test_Nothing_fromiter():
    assert lenses.setter.fromiter(Just(1), []) == Nothing()
Beispiel #8
0
def test_Just_equals_Just_when_subobjects_equal():
    # maybe hypothesis can make this more rigourous
    obj1 = object()
    obj2 = object()
    assert (Just(obj1) == Just(obj2)) is bool(obj1 == obj2)
Beispiel #9
0
def test_Just_not_equals_Nothing():
    assert Just(object()) != Nothing()
Beispiel #10
0
def test_Nothing_from_iter():
    assert lenses.hooks.from_iter(Just(1), []) == Nothing()
Beispiel #11
0
def test_Nothing_not_equals_Just():
    assert Nothing() != Just(object())
Beispiel #12
0
def test_Nothing_add_Just():
    obj = object()
    assert Nothing() + Just(obj) == Just(obj)
Beispiel #13
0
def test_Just_unwrap():
    obj = object()
    assert Just(obj).unwrap() is obj
Beispiel #14
0
def test_Just_fromiter():
    obj = object()
    assert lenses.setter.fromiter(Nothing(), [obj]) == Just(obj)
Beispiel #15
0
def test_Just_from_iter():
    obj = object()
    assert lenses.hooks.from_iter(Nothing(), [obj]) == Just(obj)
Beispiel #16
0
def test_Just_not_equals_object():
    obj = object
    assert Just(obj) != obj
Beispiel #17
0
def test_Just_maybe():
    obj = object()
    assert Just(obj).maybe() is obj
Beispiel #18
0
def test_Just_map():
    assert Just(1).map(str) == Just(str(1))
Beispiel #19
0
def test_prism_folder_success():
    obj = object
    assert list(b.JustPrism().folder(Just(obj))) == [obj]
Beispiel #20
0
def test_traversal_just_using_identity():
    assert tc.traverse(Just(1), ident) == Identity(Just(4))