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