コード例 #1
0
def test_evalute_alternatives_dict():
    a = {
        False: 'foo',
        True: 'bar'
    }
    result = evalute_alternatives(a)
    assert result == ['bar']
コード例 #2
0
def test_evalute_alternatives():
    a1 = Alternative(lambda: False)
    a2 = Alternative(lambda: True)
    a3 = Alternative(lambda: True)

    a = {  # order is important for test, usualy dict is also ok
        a1: ['foo', 'bar'],
        a2: 'bar',
        a3: ['foo1', 'bar1'],
    }

    result = evalute_alternatives(a)
    assert compare(result, ['bar', ['foo1', 'bar1']])  # order is not important
コード例 #3
0
def test_evalute_alternatives_tuple():
    a = ('foo', 'bar')
    assert evalute_alternatives(a) is a
コード例 #4
0
def test_evalute_alternatives_list():
    a = ['foo', 'bar']
    assert evalute_alternatives(a) is a