Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion a2/exercise_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def status_code_breakdown(records):
#counts = Counter(r["status_code"] for r in records if r["status_code"])
counts = {}
for r in records:
status = f"{r["status_code"][0]}xx"
status = f"{r['status_code'][0]}xx"
counts[status] = counts.get(status, 0) + 1
return counts

Expand Down
2 changes: 1 addition & 1 deletion a2/exercise_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def suspicious_ips(records, treshold=3):
def status_code_breakdown(records):
counts = {}
for request in records:
status = f"{request["status"][0]}xx"
status = f"{request['status'][0]}xx"
counts[status] = counts.get(status, 0) + 1
return counts

Expand Down
2 changes: 1 addition & 1 deletion basic_math_recursion/task3/exercise_4.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
def main():
num = int(input("Enter num> "))
print(fibonacci(num))
print(fibonaacci(num))

def fibonaacci(num):

Expand Down
2 changes: 1 addition & 1 deletion h1/exercise_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def summarize_checks(checks, results=[]):
status = parts[1]
time = parts[2]

if status is "OK":
if status == "OK":
healthy.append(server)
else:
unhealthy.append(server)
Expand Down
21 changes: 21 additions & 0 deletions tests/test_build_fixes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parents[1]))

from a2 import exercise_1, exercise_2
from basic_math_recursion.task3 import exercise_4


def test_status_code_breakdown_exercise_1():
records = [{"status_code": "200"}, {"status_code": "404"}, {"status_code": "500"}]
assert exercise_1.status_code_breakdown(records) == {"2xx": 1, "4xx": 1, "5xx": 1}


def test_status_code_breakdown_exercise_2():
records = [{"status": "200"}, {"status": "403"}, {"status": "200"}]
assert exercise_2.status_code_breakdown(records) == {"2xx": 2, "4xx": 1}


def test_fibonaacci_function_available_and_works():
assert exercise_4.fibonaacci(5) == 5
Loading