Skip to content

Commit c3f4c3a

Browse files
committed
update testing script
1 parent 045f2c8 commit c3f4c3a

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tasks/__init__.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,54 @@ def exists():
99

1010
@check50.check(exists)
1111
def test_correct_input():
12-
"""correctly accepts two command-line inputs"""
12+
"""tasks.py correctly accepts two command-line inputs"""
1313
check50.run("python3 tasks.py").exit(code=1)
1414

15+
@check50.check(exists)
16+
def test_simple_add():
17+
"""tasks.py correctly handles simple add case"""
18+
output = "1. Attend Lecture\n2. Rip a Phonebook\n3. Eat"
19+
check50.run("python3 tasks.py monday.txt").stdin("add Eat", prompt=True).stdout(regex(output), output).kill()
20+
1521
@check50.check(exists)
1622
def test_print_add():
17-
"""correctly prints added task"""
23+
"""tasks.py correctly prints added task"""
1824
output = "1. Attend Lecture\n2. Rip a Phonebook\n3. Call David"
1925
check50.run("python3 tasks.py monday.txt").stdin("add Call David", prompt=True).stdout(regex(output), output).kill()
2026

2127
@check50.check(exists)
2228
def test_case_add():
23-
"""disregards the case of add"""
29+
"""tasks.py correctly handles case-sensitive add"""
2430
output = "1. Attend Lecture\n2. Rip a Phonebook\n3. Call David"
2531
check50.run("python3 tasks.py monday.txt").stdin("aDd Call David", prompt=True).stdout(regex(output), output).kill()
2632

27-
@check50.check(exists)
28-
def test_add_txt():
29-
"""test"""
30-
check50.run("python3 testing.py get_level")
31-
3233
@check50.check(exists)
3334
def test_print_remove():
34-
"""correctly prints list after removal"""
35+
"""tasks.py correctly prints list after removal"""
3536
output = "1. Rip a Phonebook"
3637
check50.run("python3 tasks.py monday.txt").stdin("remove Attend Lecture", prompt=True).stdout(regex(output), output).kill()
3738

3839
@check50.check(exists)
3940
def test_case_remove():
40-
"""disregards the case of remove"""
41+
"""tasks.py correctly handles case-sensitive remove"""
4142
output = "1. Rip a Phonebook"
4243
check50.run("python3 tasks.py monday.txt").stdin("rEMoVe Attend Lecture", prompt=True).stdout(regex(output), output).kill()
4344

4445
@check50.check(exists)
4546
def test_invalid_remove():
46-
"""correctly exits when no match to remove"""
47+
"""tasks.py correctly exits when no match to remove"""
4748
check50.run("python3 tasks.py monday.txt").stdin("remove Feed the Cat", prompt=True).exit(code=1)
4849

4950
@check50.check(exists)
5051
def test_just_command():
51-
"""correctly exits when no description"""
52+
"""tasks.py correctly exits when no task is given"""
5253
check50.run("python3 tasks.py monday.txt").stdin("add", prompt=True).exit(code=1)
5354

5455
@check50.check(exists)
5556
def test_invalid_command():
56-
"""correctly exits when invalid command"""
57+
"""tasks.py correctly exits when invalid operation"""
5758
check50.run("python3 tasks.py monday.txt").stdin("edit Rip a Phonebook", prompt=True).exit(code=1)
5859

5960
def regex(text):
6061
"""match case-sensitively with any characters on either side"""
61-
return rf"^.*{escape(text)}.*$"
62+
return rf"^.*{escape(text)}.*$"

0 commit comments

Comments
 (0)