def test_Just_iter(): obj = object() assert list(Just(obj)) == [obj]
def test_Just_add_monoid_empty(): obj = object() value = Just(obj) assert value + mempty(value) == value
def test_Just_repr_conatins_subobject(): obj = object() assert repr(obj) in repr(Just(obj))
def test_Just_add_Nothing(): obj = object() assert Just(obj) + Nothing() == Just(obj)
def test_Just_add_Just(): assert Just([1]) + Just([2]) == Just([1, 2])
def test_IsomorphismLens_unpack(): assert b.Isomorphism(int, str).unpack('1') == Just(1)
def test_Nothing_fromiter(): assert lenses.setter.fromiter(Just(1), []) == Nothing()
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)
def test_Just_not_equals_Nothing(): assert Just(object()) != Nothing()
def test_Nothing_from_iter(): assert lenses.hooks.from_iter(Just(1), []) == Nothing()
def test_Nothing_not_equals_Just(): assert Nothing() != Just(object())
def test_Nothing_add_Just(): obj = object() assert Nothing() + Just(obj) == Just(obj)
def test_Just_unwrap(): obj = object() assert Just(obj).unwrap() is obj
def test_Just_fromiter(): obj = object() assert lenses.setter.fromiter(Nothing(), [obj]) == Just(obj)
def test_Just_from_iter(): obj = object() assert lenses.hooks.from_iter(Nothing(), [obj]) == Just(obj)
def test_Just_not_equals_object(): obj = object assert Just(obj) != obj
def test_Just_maybe(): obj = object() assert Just(obj).maybe() is obj
def test_Just_map(): assert Just(1).map(str) == Just(str(1))
def test_prism_folder_success(): obj = object assert list(b.JustPrism().folder(Just(obj))) == [obj]
def test_traversal_just_using_identity(): assert tc.traverse(Just(1), ident) == Identity(Just(4))