Ejemplo n.º 1
0
def check(testfile, exp_status, status, out, err):
    res = dict(testfile=testfile, status=status, out=out, err=err,
               exp_out="", exp_err="", exp_status=exp_status)

    check = (exp_status == status)

    err_file = testfile + ".err"
    if os.path.exists(err_file):
        exp_err = file(err_file).read()
        res["exp_err"] = exp_err

        err_check = compare(exp_err, err, strict=False)
        check = check and err_check[0]

    out_file = testfile + ".out"
    if os.path.exists(out_file):
        exp_out = file(out_file).read()
        res["exp_out"] = exp_out

        out_check = compare(exp_out, out, strict=False)
        check = check and out_check[0]

    res["check"] = check

    return res
Ejemplo n.º 2
0
 def test_compare_equal(self):
     res = compare("equal", "equal")
     assert res[0]
Ejemplo n.º 3
0
 def test_compare_toolong_strict(self):
     res = compare("1 2 3", "1 2 3 4", strict=True)
     assert not res[0]
     assert "got 4 but nothing was expected" in res[1]
Ejemplo n.º 4
0
 def test_compare_toolong(self):
     res = compare("1 2 3", "1 2 3 4")
     assert res[0]
Ejemplo n.º 5
0
 def test_compare_tooshort(self):
     res = compare("1 2 3 4", "1 2 3")
     assert not res[0]
     assert "was expecting 4 at the end" in res[1]