Skip to content

Commit 0e6a43e

Browse files
committed
16-Random-Colors-Loop
1 parent b020d10 commit 0e6a43e

File tree

1 file changed

+15
-15
lines changed
  • exercises/16-Random-Colors-Loop

1 file changed

+15
-15
lines changed

exercises/16-Random-Colors-Loop/test.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ def test_for_file_output(capsys, app):
2626
result = get_allStudentColors()
2727
assert len(result) == 10
2828

29-
from unittest.mock import patch
30-
@pytest.mark.it('You should use print 10 times')
31-
@patch('builtins.print')
32-
def test_print_times(mock_print):
33-
# The actual test
34-
# import the function that use print
35-
from app import get_allStudentColors
36-
get_allStudentColors()
29+
# from unittest.mock import patch
30+
# @pytest.mark.it('You should use print 10 times')
31+
# @patch('builtins.print')
32+
# def test_print_times(mock_print):
33+
# # The actual test
34+
# # import the function that use print
35+
# from app import get_allStudentColors
36+
# get_allStudentColors()
3737

38-
# we need the call format to know how many calls print has.
39-
from mock import call
40-
calls = []
41-
for x in range(10):
42-
calls.append(call(x))
43-
# calls = [call(0),call(1),call(2),call(3),call(4),call(5),call(6),call(7),call(8),call(9)]
44-
mock_print.assert_has_calls(calls, any_order=False) # set any_order to False to respect the iteration sequence (0,1,2,3,4...etc.)
38+
# # we need the call format to know how many calls print has.
39+
# from mock import call
40+
# calls = []
41+
# for x in range(10):
42+
# calls.append(call(x))
43+
# # calls = [call(0),call(1),call(2),call(3),call(4),call(5),call(6),call(7),call(8),call(9)]
44+
# mock_print.assert_has_calls(calls, any_order=False) # set any_order to False to respect the iteration sequence (0,1,2,3,4...etc.)
4545

4646

4747
@pytest.mark.it('You should use for to iterate 10 times')

0 commit comments

Comments
 (0)