예제 #1
0
def test_fuzz_invalid(caveat):
    try:
        result = parse(caveat)
    except ParseException:
        # parse errors are probably a good thing. keep moving along.
        return
    key, opr, val = result
    assert opr in VALID_OPERATIONS
    assert _type_check([str], key)
    assert _type_check([str, int, list], val)
예제 #2
0
#!/usr/bin/env python
import caveats

blocks = caveats.parse("CAVEATS.md")
tests = caveats.format_(blocks)

# Write formatted tests
with open("test_caveats.py", "w") as f:
    f.write("".join(tests))
예제 #3
0
def test_parser(caveat, expected):
    result = parse(caveat)
    assert len(expected) == 3
    assert result[0] == expected[0]
    assert result[1] == expected[1]
    assert result[2] == expected[2]
예제 #4
0
def test_invalid_strings(caveat):
    with pytest.raises(ParseException):
        print(parse(caveat))
예제 #5
0
#!/usr/bin/env python
import caveats

blocks = caveats.parse("CAVEATS.md")
tests = caveats.format_(blocks)

# Write formatted tests
with open("test_caveats.py", "w") as f:
    f.write("".join(tests))