Skip to content

Commit d48fbe5

Browse files
committed
37-validity-of-password
1 parent df4bdde commit d48fbe5

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

exercises/37-validity-of-password/solution.hide.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import re
22
value = []
3-
items=[x for x in input().split(',')]
3+
items=[x for x in input("").split(',')]
44
for p in items:
55
if len(p)<6 or len(p)>12:
66
continue

exercises/37-validity-of-password/test.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff 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"

0 commit comments

Comments
 (0)