Skip to content

Commit bda5448

Browse files
authored
Update test.py
1 parent 58e5a67 commit bda5448

File tree

1 file changed

+7
-5
lines changed
  • exercises/40-compute-robot-distance

1 file changed

+7
-5
lines changed
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import pytest, io, sys, json, mock, re, os
22

3-
43
@pytest.mark.it('The function compute_robot_distance must exist')
54
def test_function_existence(capsys, app):
65
assert app.compute_robot_distance
76

87
@pytest.mark.it('The function should return the expected output')
98
def test_expected_output(capsys, app):
10-
assert app.compute_robot_distance("UP 5 DOWN 3 LEFT 3 RIGHT 2") == 2
9+
movements_list = ["UP 5", "DOWN 3", "LEFT 3", "RIGHT 2"]
10+
assert app.compute_robot_distance(movements_list) == 2
1111

1212
@pytest.mark.it('The solution should work with other entries')
1313
def test_another_output(capsys, app):
14-
assert app.compute_robot_distance("DOWN 20 UP 5 LEFT 5 RIGHT 2") == 15
14+
movements_list = ["DOWN 20", "UP 5", "LEFT 5", "RIGHT 2"]
15+
assert app.compute_robot_distance(movements_list) == 15
1516

16-
@pytest.mark.it('The solution should work with other entries')
17+
@pytest.mark.it('The solution should work with negative inputs')
1718
def test_negative_inputs(capsys, app):
18-
assert app.compute_robot_distance("DOWN -1 UP -5 LEFT 50 RIGHT 20") == 30
19+
movements_list = ["DOWN -1", "UP -5", "LEFT 50", "RIGHT 20"]
20+
assert app.compute_robot_distance(movements_list) == 30

0 commit comments

Comments
 (0)