Beispiel #1
0
def test_EachLens_set_with_starting_filtered():
    def f(a):
        return a != 2
    assert b.EachLens(f).set([1, 2, 3], 4) == [4, 4]
Beispiel #2
0
def test_EachLens_set_filtered():
    def f(a):
        return a != 4
    assert b.EachLens(f).set([1, 2, 3], 4) == []
Beispiel #3
0
def test_EachLens_set_None():
    assert b.EachLens(filter_none=True).set([1, 2, 3], None) == []
Beispiel #4
0
def test_EachLens_get_all_with_starting_filtered():
    def f(a):
        return a != 2
    assert b.EachLens(f).get_all([1, 2, 3]) == [1, 3]
Beispiel #5
0
def test_EachLens_get_all_with_starting_None():
    assert b.EachLens(filter_none=True).get_all([None, None]) == []
Beispiel #6
0
def test_EachLens_set_with_starting_None():
    assert b.EachLens(filter_none=True).set([None, None], 4) == []
Beispiel #7
0
def test_EachLens_get_all_empty():
    assert b.EachLens().get_all([]) == []
Beispiel #8
0
def test_EachLens_set_empty():
    assert b.EachLens().set([], 4) == []
Beispiel #9
0
def test_EachLens_modify_on_set():
    assert b.EachLens().modify({1, 2, 3}, lambda a: a+1) == {2, 3, 4}
Beispiel #10
0
def test_EachLens_set_on_set():
    assert b.EachLens().set({1, 2, 3}, 4) == {4}
Beispiel #11
0
def test_EachLens_get_all_on_set():
    assert sorted(b.EachLens().get_all({1, 2, 3})) == [1, 2, 3]
Beispiel #12
0
def test_EachLens_set():
    assert b.EachLens().set([1, 2, 3], 4) == [4, 4, 4]
Beispiel #13
0
def test_EachLens_get_all():
    assert b.EachLens().get_all([1, 2, 3]) == [1, 2, 3]