def test_match(): err = "hard link not allowed for directory" assert not match(Command()) cmd1 = Command("ln barDir barLink", stderr="ln: ‘barDir’: {}".format(err)) assert match(cmd1) cmd2 = Command("sudo ln a b", stderr="ln: ‘a’: {}".format(err)) assert match(cmd2) cmd3 = Command("ln a b", stderr="... hard link") assert not match(cmd3) cmd4 = Command("sudo ln a b", stderr="... hard link") assert not match(cmd4) cmd5 = Command("a b", stderr=err) assert not match(cmd5) cmd6 = Command("sudo ln -nbi a b", stderr="ln: ‘a’: {}".format(err)) assert match(cmd6)
def test_assert_not_match(script, stderr): command = Command(script, stderr=stderr) assert not match(command)
def test_match(script, stderr): command = Command(script, stderr=stderr.format(error)) assert match(command)
def test_not_match(script, output): command = Command(script, output) assert not match(command)
def test_match(script, output): command = Command(script, output.format(error)) assert match(command)
def test_not_match(script, output): command = Command(script, output) assert not match(command)
def test_match(script, output): command = Command(script, output.format(error)) assert match(command)
def test_not_match(script, stderr): command = Command(script, stderr=stderr) assert not match(command)
def test_match(script, stderr): command = Command(script, stderr=stderr.format(error)) assert match(command)