Ejemplo n.º 1
0

@parametrize('case,expected', [(_.times(2, _.stub_false), [False, False]),
                               (_.stub_false(), False)])
def test_stub_false(case, expected):
    assert case == expected


@parametrize('case,expected', [(_.times(2, _.stub_string), ['', '']),
                               (_.stub_string(), '')])
def test_stub_string(case, expected):
    assert case == expected


@parametrize('case,expected', [(_.times(2, _.stub_true), [True, True]),
                               (_.stub_true(), True)])
def test_stub_true(case, expected):
    assert case == expected


@parametrize('case,expected', [((5, lambda i: i * i), [0, 1, 4, 9, 16])])
def test_times(case, expected):
    assert _.times(*case) == expected


@parametrize('case,expected', [('a.b.c', ['a', 'b', 'c']),
                               ('a[0].b.c', ['a', 0, 'b', 'c']),
                               ('a[0][1][2].b.c', ['a', 0, 1, 2, 'b', 'c'])])
def test_to_path(case, expected):
    assert _.to_path(case) == expected
Ejemplo n.º 2
0
])
def test_stub_false(case, expected):
    assert case == expected


@parametrize('case,expected', [
    (_.times(2, _.stub_string), ['', '']),
    (_.stub_string(), '')
])
def test_stub_string(case, expected):
    assert case == expected


@parametrize('case,expected', [
    (_.times(2, _.stub_true), [True, True]),
    (_.stub_true(), True)
])
def test_stub_true(case, expected):
    assert case == expected


@parametrize('case,expected', [
    ((5, lambda i: i * i), [0, 1, 4, 9, 16]),
    ((5,), [0, 1, 2, 3, 4])
])
def test_times(case, expected):
    assert _.times(*case) == expected


@parametrize('case,expected', [
    ('a.b.c', ['a', 'b', 'c']),