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)
#!/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))
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]
def test_invalid_strings(caveat): with pytest.raises(ParseException): print(parse(caveat))