Exemplo n.º 1
0
def test_numbers(data, spec):
    MatchType('$', dict(match='type')).apply(data, spec, ['a'])
Exemplo n.º 2
0
def test_max_not_met():
    with pytest.raises(RuleFailed):
        MatchType('$', dict(match='type', max=2)).apply([1, 2, 3], [1, 2], ['spam'])
Exemplo n.º 3
0
def test_max_ignored():
    MatchType('$', dict(match='type', max=1)).apply(0, 0, [])
Exemplo n.º 4
0
def test_stringify():
    r = MatchType('$', {'match': 'type'})
    assert str(r) == "Rule match by {'match': 'type'} at $"
    assert repr(r) == "<MatchType $ {'match': 'type'}>"
Exemplo n.º 5
0
def test_max():
    MatchType('$', dict(match='type', max=1)).apply(['spam'], ['a'], [])
Exemplo n.º 6
0
def test_numbers(data, spec):
    MatchType("$", dict(match="type")).apply(data, spec, ["a"])
Exemplo n.º 7
0
def test_min_not_met():
    with pytest.raises(RuleFailed):
        MatchType('$', dict(match='type', min=2)).apply(['spam'], ['a', 'b'], ['spam'])
Exemplo n.º 8
0
def test_stringify():
    r = MatchType("$", {"match": "type"})
    assert str(r) == "Rule match by {'match': 'type'} at $"
    assert repr(r) == "<MatchType path='$' rule={'match': 'type'}>"
Exemplo n.º 9
0
def test_max_ignored():
    MatchType("$", dict(match="type", max=1)).apply(0, 0, [])
Exemplo n.º 10
0
def test_max_not_met():
    with pytest.raises(RuleFailed):
        MatchType("$", dict(match="type", max=2)).apply([1, 2, 3], [1, 2],
                                                        ["spam"])
Exemplo n.º 11
0
def test_max():
    MatchType("$", dict(match="type", max=1)).apply(["spam"], ["a"], [])
Exemplo n.º 12
0
def test_min_not_met():
    with pytest.raises(RuleFailed):
        MatchType("$", dict(match="type", min=2)).apply(["spam"], ["a", "b"],
                                                        ["spam"])