File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
exercises/37-validity-of-password Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change 11import re
22value = []
3- items = [x for x in input ().split (',' )]
3+ items = [x for x in input ("" ).split (',' )]
44for p in items :
55 if len (p )< 6 or len (p )> 12 :
66 continue
Original file line number Diff line number Diff line change @@ -7,4 +7,20 @@ def test_expected_output(capsys, app):
77 with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
88 app ()
99 captured = capsys .readouterr ()
10- assert captured .out == "ABd1234@1\n "
10+ assert captured .out == "ABd1234@1\n "
11+
12+ @pytest .mark .it ('Your solution should work as expected for valid passwords' )
13+ def test_expected_another_output (capsys , app ):
14+ fake_input = ['Lmd4567@2,a F1#,2w3E*,2We3345' ]
15+ with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
16+ app ()
17+ captured = capsys .readouterr ()
18+ assert captured .out == "Lmd4567@2\n "
19+
20+ @pytest .mark .it ('Your solution should work as expected when there is no valid password input' )
21+ def test_expected_output_no_valid_entries (capsys , app ):
22+ fake_input = ['ABd12,a F1#,2w3E*,2We3345' ]
23+ with mock .patch ('builtins.input' , lambda x : fake_input .pop ()):
24+ app ()
25+ captured = capsys .readouterr ()
26+ assert captured .out == "\n "
You can’t perform that action at this time.
0 commit comments