Skip to content

Commit 28a5b83

Browse files
committed
Made tests more flexible
1 parent 68dfa54 commit 28a5b83

File tree

1 file changed

+6
-6
lines changed
  • exercises/08.1-Your-First-If

1 file changed

+6
-6
lines changed

exercises/08.1-Your-First-If/test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,39 @@ def test_for_output_when_101(stdin, capsys, app):
2929
with mock.patch('builtins.input', lambda x: 101):
3030
app()
3131
captured = capsys.readouterr()
32-
assert "Give me your money!\n" == captured.out
32+
assert "Give me your money!\n" in captured.out
3333

3434
@pytest.mark.it("When input exactly 100 should print: Buy me some coffee you cheap ")
3535
def test_for_output_when_100(capsys, app):
3636
with mock.patch('builtins.input', lambda x: 100):
3737
app()
3838
captured = capsys.readouterr()
39-
assert "Buy me some coffee you cheap!\n" == captured.out
39+
assert "Buy me some coffee you cheap!\n" in captured.out
4040

4141
@pytest.mark.it("When input is 99 should print: Buy me some coffee you cheap ")
4242
def test_for_output_when_99(capsys, app):
4343
with mock.patch('builtins.input', lambda x: 99):
4444
app()
4545
captured = capsys.readouterr()
46-
assert "Buy me some coffee you cheap!\n" == captured.out
46+
assert "Buy me some coffee you cheap!\n" in captured.out
4747

4848
@pytest.mark.it("When input is 51 should print: Buy me some coffee you cheap ")
4949
def test_for_output_when_51(capsys, app):
5050
with mock.patch('builtins.input', lambda x: 51):
5151
app()
5252
captured = capsys.readouterr()
53-
assert "Buy me some coffee you cheap!\n" == captured.out
53+
assert "Buy me some coffee you cheap!\n" in captured.out
5454

5555
@pytest.mark.it("When input exactly 50 should print: You are a poor guy, go away")
5656
def test_for_output_when_50(capsys, app):
5757
with mock.patch('builtins.input', lambda x: 50):
5858
app()
5959
captured = capsys.readouterr()
60-
assert "You are a poor guy, go away!\n" == captured.out
60+
assert "You are a poor guy, go away!\n" in captured.out
6161

6262
@pytest.mark.it("When input less than 50 should print: You are a poor guy, go away")
6363
def test_for_output_when_49(capsys, app):
6464
with mock.patch('builtins.input', lambda x: 49):
6565
app()
6666
captured = capsys.readouterr()
67-
assert "You are a poor guy, go away!\n" == captured.out
67+
assert "You are a poor guy, go away!\n" in captured.out

0 commit comments

Comments
 (0)