def test_exercise(): os.chdir('src') input_values = ["data.csv","FURIA","data.csv","ENCE"] output = [] def mock_input(s=None): if s is not None: output.append(s) return input_values.pop(0) else: output.append("") return input_values.pop(0) exercise.input = mock_input exercise.print = lambda s : output.append(s) exercise.main() exercise.input = mock_input exercise.print = lambda s : output.append(s) exercise.main() assert output == ["File:","Team:","Games: 2","Wins: 1","Losses: 1",\ "File:","Team:","Games: 6","Wins: 3","Losses: 3"]
def test_exercise(capsys): main() out, err = capsys.readouterr() assert out == "Matthew's account, balance: 900\nMy account, balance: 100\n"
def test_exercise(capsys): main() out, err = capsys.readouterr() assert 'Hi' in out, "Output should contain Hi"
def test_exercise(capsys): main() out, err = capsys.readouterr() assert out == "In a hole in the ground there lived a method\n", "Should read 'In a hole in the ground there lived a method'"
def test_exercise(capsys): os.chdir('src') main() out, err = capsys.readouterr() assert out == "In a\nworld\n"
def test_exercise(capsys): main() out, err = capsys.readouterr() assert out == "Once upon a time\nthere was\na dinosaur\n", "Should read:\n 'Once upon a time\nthere was\na dinosaur\n'"
def test_exercise(capsys): main() output = [] output,err = capsys.readouterr() assert output == "Chicken:\n9000\nBacon (kg):\n0.1\nTractor:\nZero\n\nAnd finally, a summary:\n9000\n0.1\nZero\n"
def test_exercise(capsys): main() out, err = capsys.readouterr() assert out == "Ada Lovelace\n", "Should read 'Ada Lovelace'"
def test_exercise(capsys): main() out, err = capsys.readouterr() assert out == '120\n'