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