Exemplo n.º 1
0
        'on_exception': 5
    }, TypeError),
])
def test_retry_invalid_args(case, exception):
    with pytest.raises(exception):
        _.retry(**case)


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


@parametrize('case,expected', [(_.times(2, _.stub_dict), [{}, {}]),
                               (_.stub_dict(), {})])
def test_stub_dict(case, expected):
    assert case == expected


@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
Exemplo n.º 2
0
def test_retry_invalid_args(case, exception):
    with pytest.raises(exception):
        _.retry(**case)


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


@parametrize('case,expected', [
    (_.times(2, _.stub_dict), [{}, {}]),
    (_.stub_dict(), {})
])
def test_stub_dict(case, expected):
    assert case == expected


@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), ['', '']),