Skip to content

Commit a74ba7f

Browse files
committed
38-sort-tuples-ascending
1 parent 8eb00be commit a74ba7f

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import pytest, io, sys, json, mock, re, os
22

3-
@pytest.mark.it('')
3+
@pytest.mark.it('Your solution should work as expected')
44
def test_expected_output(capsys, app):
55
fake_input=['Hola como Hola']
66
with mock.patch('builtins.input', lambda x: fake_input.pop()):
77
app()
88
captured = capsys.readouterr()
9-
assert captured.out != " como \n"
9+
assert captured.out == " como \n"

exercises/38-sort-tuples-ascending/solution.hide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
break
88
l.append(tuple(s.split(",")))
99

10-
print sorted(l, key=itemgetter(0,1,2))
10+
print (sorted(l, key=itemgetter(0,1,2)))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import pytest, io, sys, json, mock, re, os
2+
path = os.path.dirname(os.path.abspath(__file__))+'/app.py'
3+
4+
@pytest.mark.it('The solution should return the expected output')
5+
def test_convert_inputs(capsys, app):
6+
7+
fake_input = ["Tom,19,80 John,20,90 Jony,17,91 Jony,17,93 Json,21,85"] #fake input
8+
with mock.patch('builtins.input', lambda x: fake_input.pop()):
9+
app()
10+
captured = capsys.readouterr()
11+
assert captured.out == "[('John', '20', '90'), ('Jony', '17', '91'), ('Jony', '17', '93'), ('Json', '21', '85'), ('Tom', '19', '80')]\n"

0 commit comments

Comments
 (0)