Skip to content

Commit 81f0d51

Browse files
authored
Merge branch '2025/x' into inheritance-checks-fixes
2 parents 0be3250 + 5c8dc5f commit 81f0d51

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

finance/.cs50.yml

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ check50:
44
files: &check50_files
55
- !exclude "*.pyc"
66
- !exclude __pycache__
7+
- !exclude venv
78
- !require app.py
89
- !require finance.db
910
- !require helpers.py

finance/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def register_page():
3030

3131
@check50.check(register_page)
3232
def simple_register():
33-
"""registering user succeeds and portfolio page is displayed"""
33+
"""registering user succeeds (and login or portfolio page is displayed)"""
3434
Finance().register("_cs50", "ohHai28!", "ohHai28!").status(200)
3535

3636

@@ -247,4 +247,4 @@ def validate_form(self, route, fields, field_tag="input"):
247247
return self
248248

249249
def page_exists(self, route):
250-
return self.get(route).status() == 200
250+
return self.get(route).status() == 200

finance/lookup.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
def lookup(symbol):
22
symbol = symbol.upper()
33
if (symbol == "AAAA"):
4-
return {"price": 28.00, "symbol": "AAAA"}
4+
return {"name": "AAAA stock", "price": 28.00, "symbol": "AAAA"}
55
elif (symbol == "BBBB"):
6-
return {"price": 14.00, "symbol": "BBBB"}
6+
return {"name": "BBBB stock", "price": 14.00, "symbol": "BBBB"}
77
elif (symbol == "CCCC"):
8-
return {"price": 2000.00, "symbol": "CCCC"}
8+
return {"name": "CCCC stock", "price": 2000.00, "symbol": "CCCC"}
99
else:
1010
return None

inheritance/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def compiles():
1818
def compiles_test():
1919
"""inheritance compiles"""
2020
check50.c.compile("inheritance.c", lcs50=True)
21-
inheritance = re.sub(r"int\s+main", "int distro_main", open("inheritance.c").read())
21+
inheritance = re.sub(r"int\s+main\(", "int distro_main(", open("inheritance.c").read())
2222
testing = open("testing.c").read()
2323
with open("inheritance_test.c", "w") as f:
2424
f.write(inheritance)

movies/__init__.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ def test9():
125125
"Rupert Grint",
126126
"Daniel Radcliffe",
127127
"Emma Watson",
128-
"Emma Watson",
129128
],
130129
ordered=True,
131130
)
@@ -222,6 +221,7 @@ def check_single_col(actual, expected, ordered=False):
222221
# Get data from column
223222
try:
224223
result = [str(list(row.values())[0]) for row in actual]
224+
result = result if ordered else set(result)
225225
except IndexError:
226226
return None
227227

@@ -230,8 +230,7 @@ def check_single_col(actual, expected, ordered=False):
230230

231231
# If unordered, sort both before checking
232232
if not ordered:
233-
result.sort()
234-
expected.sort()
233+
expected = set(expected)
235234

236235
if result != expected:
237236
raise check50.Mismatch("\n".join(expected), "\n".join(list(result)))

movies/movies.db

0 Bytes
Binary file not shown.

plurality/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def exists():
1414
def compiles():
1515
"""plurality compiles"""
1616
check50.c.compile("plurality.c", lcs50=True)
17-
plurality = re.sub("int\s+main", "int distro_main", open("plurality.c").read())
17+
plurality = re.sub(r"int\s+main\(", "int distro_main(", open("plurality.c").read())
1818
testing = open("testing.c").read()
1919
with open("plurality_test.c", "w") as f:
2020
f.write(plurality)
@@ -128,4 +128,4 @@ def check_winner(result, correct):
128128
else:
129129
help = "did you forget the newline after the name?"
130130

131-
raise check50.Mismatch(correct, result, help=help)
131+
raise check50.Mismatch(correct, result, help=help)

runoff/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def exists():
1414
def compiles():
1515
"""runoff compiles"""
1616
check50.c.compile("runoff.c", lcs50=True)
17-
runoff = re.sub("int\s+main", "int distro_main", open("runoff.c").read())
17+
runoff = re.sub(r"int\s+main\(", "int distro_main(", open("runoff.c").read())
1818
testing = open("testing.c").read()
1919
with open("runoff_test.c", "w") as f:
2020
f.write(runoff)

tideman/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def exists():
1414
def compiles():
1515
"""tideman compiles"""
1616
check50.c.compile("tideman.c", lcs50=True)
17-
tideman = re.sub("int\s+main", "int distro_main", open("tideman.c").read())
17+
tideman = re.sub(r"int\s+main\(", "int distro_main(", open("tideman.c").read())
1818
testing = open("testing.c").read()
1919
with open("tideman_test.c", "w") as f:
2020
f.write(tideman)

wordle/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def compiles():
1919
check50.c.compile("wordle.c", lcs50=True)
2020

2121
# Rename main function to "distro_main"
22-
wordle = re.sub("int\s+main", "int distro_main", open("wordle.c").read())
22+
wordle = re.sub(r"int\s+main\(", "int distro_main(", open("wordle.c").read())
2323

2424
# Read testing file
2525
testing = open("testing.c").read()
@@ -99,7 +99,7 @@ def partial_match_repeat_letter():
9999
"""wordle recognizes guess with a repeat letter"""
100100
for word in ["joust", "pines", "links"]:
101101
check50.c.run(f"./wordle_test check_word grass {word}").stdout(3)
102-
102+
103103
@check50.check(compiles)
104104
def partial_multiple_matches():
105105
"""wordle recognizes guess with multiple matches"""

0 commit comments

Comments
 (0)