Skip to content

Commit ddeb940

Browse files
authored
Update __init__.py
1 parent 6416381 commit ddeb940

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

jar/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,15 @@ def test_number_functions():
7777
raise check50.Failure(
7878
"test_jar.py does not contain at least four valid functions"
7979
)
80+
81+
@check50.check(test_student_file_passes)
82+
def test_named_functions():
83+
"""test_jar.py defines test_init, test_str, test_deposit, and test_withdraw"""
84+
with open("test_jar.py") as t:
85+
contents = t.read()
86+
87+
funcs = ["test_init", "test_str", "test_deposit", "test_withdraw"]
88+
for func in funcs:
89+
matches = re.search(rf"def\s+{func}\s*\(", contents)
90+
if not matches:
91+
raise check50.Failure(f"{func} not found in test_jar.py")

0 commit comments

Comments
 (0)