Skip to content

Commit df4bdde

Browse files
committed
36-net-amount
1 parent 47f7952 commit df4bdde

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

exercises/36-net-amount/solution.hide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
netAmount = 0
22
while True:
3-
s = raw_input()
3+
s = input("")
44
if not s:
55
break
66
values = s.split(" ")
@@ -12,4 +12,4 @@
1212
netAmount-=amount
1313
else:
1414
pass
15-
print netAmount
15+
print (netAmount)

exercises/36-net-amount/test.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1-
import pytest, io, sys, json, mock, re, os, app
1+
import pytest, io, sys, json, mock, re, os
22
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
33

4+
@pytest.mark.it('The solution should return the expected output')
5+
def test_output(capsys, app):
6+
fake_input = ["D 300 D 300 W 200 D 100"] #fake input
7+
with mock.patch('builtins.input', lambda x: fake_input.pop()):
8+
app()
9+
captured = capsys.readouterr()
10+
assert captured.out == "500\n"
11+

0 commit comments

Comments
 (0)