From 74a36d9a96f1664766e64a7b796d8d60a383c755 Mon Sep 17 00:00:00 2001 From: mercael91 Date: Fri, 23 Oct 2026 19:18:58 +0300 Subject: [PATCH 1/8] Add actionable assertion messages to functional7 and functional8 checks Signed-off-by: mercael --- checks/functional/functional7.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checks/functional/functional7.py b/checks/functional/functional7.py index 1d88fa5..f71981f 100644 --- a/checks/functional/functional7.py +++ b/checks/functional/functional7.py @@ -3,6 +3,6 @@ assert triple(4) == 12, f"triple(4) should be 12, got {triple(4)}" assert double(7) == 14, f"double(7) should be 14, got {double(7)}" -assert make_multiplier(10)(5) == 50 -assert callable(make_multiplier(1)) +assert make_multiplier(10)(5) == 50, f"make_multiplier(10)(5) should be 50, got {make_multiplier(10)(5)}" +assert callable(make_multiplier(1)), "make_multiplier(1) should return a callable" print("functional7 ✓") From a8bb123421327fe427fcaf07f36adba4dec78319 Mon Sep 17 00:00:00 2001 From: mercael91 Date: Fri, 23 Oct 2026 19:18:59 +0300 Subject: [PATCH 2/8] Add actionable assertion messages to functional7 and functional8 checks Signed-off-by: mercael --- checks/functional/functional8.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checks/functional/functional8.py b/checks/functional/functional8.py index 110f1be..716c6b7 100644 --- a/checks/functional/functional8.py +++ b/checks/functional/functional8.py @@ -2,6 +2,6 @@ from functools import reduce -assert reduce(lambda a, b: a * b, [2, 3, 4]) == 24 -assert reduce(lambda a, b: a + b, [1, 2, 3, 4]) == 10 +assert reduce(lambda a, b: a * b, [2, 3, 4]) == 24, f"reduce product of [2, 3, 4] should be 24, got {reduce(lambda a, b: a * b, [2, 3, 4])}" +assert reduce(lambda a, b: a + b, [1, 2, 3, 4]) == 10, f"reduce sum of [1, 2, 3, 4] should be 10, got {reduce(lambda a, b: a + b, [1, 2, 3, 4])}" print("functional8 ✓") From 9aa4f6e30353b9dc04920d261ec31bba12980387 Mon Sep 17 00:00:00 2001 From: mercael91 Date: Fri, 23 Oct 2026 19:19:01 +0300 Subject: [PATCH 3/8] Add actionable assertion messages to functional7 and functional8 checks Signed-off-by: mercael --- tests/test_functional_assertion_messages.py | 24 +++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/test_functional_assertion_messages.py diff --git a/tests/test_functional_assertion_messages.py b/tests/test_functional_assertion_messages.py new file mode 100644 index 0000000..ad04e9e --- /dev/null +++ b/tests/test_functional_assertion_messages.py @@ -0,0 +1,24 @@ +import ast +from pathlib import Path + + +CHECKS_DIR = Path(__file__).resolve().parent.parent / "checks" / "functional" + + +def _asserts_without_message(path): + tree = ast.parse(path.read_text(encoding="utf-8")) + missing = [] + for node in ast.walk(tree): + if isinstance(node, ast.Assert) and node.msg is None: + missing.append(node.lineno) + return missing + + +def test_functional7_asserts_have_messages(): + path = CHECKS_DIR / "functional7.py" + assert _asserts_without_message(path) == [] + + +def test_functional8_asserts_have_messages(): + path = CHECKS_DIR / "functional8.py" + assert _asserts_without_message(path) == [] From 07c9faad53228f8f58e26f6c8c2c8d0ec0d1add5 Mon Sep 17 00:00:00 2001 From: mercael Date: Fri, 23 Oct 2026 19:33:11 +0300 Subject: [PATCH 4/8] Add actionable assertion messages to functional7, functional8 and functional9 checks Signed-off-by: mercael --- checks/functional/functional7.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/checks/functional/functional7.py b/checks/functional/functional7.py index f71981f..ccc75c2 100644 --- a/checks/functional/functional7.py +++ b/checks/functional/functional7.py @@ -3,6 +3,6 @@ assert triple(4) == 12, f"triple(4) should be 12, got {triple(4)}" assert double(7) == 14, f"double(7) should be 14, got {double(7)}" -assert make_multiplier(10)(5) == 50, f"make_multiplier(10)(5) should be 50, got {make_multiplier(10)(5)}" -assert callable(make_multiplier(1)), "make_multiplier(1) should return a callable" +assert make_multiplier(10)(5) == 50, "make_multiplier(10)(5) should be 50" +assert callable(make_multiplier(1)), "make_multiplier(1) should be a function" print("functional7 ✓") From 0be658d0f438012335ae5a762d562a19f22d1f2d Mon Sep 17 00:00:00 2001 From: mercael Date: Fri, 23 Oct 2026 19:33:13 +0300 Subject: [PATCH 5/8] Add actionable assertion messages to functional7, functional8 and functional9 checks Signed-off-by: mercael --- checks/functional/functional8.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/checks/functional/functional8.py b/checks/functional/functional8.py index 716c6b7..4447352 100644 --- a/checks/functional/functional8.py +++ b/checks/functional/functional8.py @@ -2,6 +2,10 @@ from functools import reduce -assert reduce(lambda a, b: a * b, [2, 3, 4]) == 24, f"reduce product of [2, 3, 4] should be 24, got {reduce(lambda a, b: a * b, [2, 3, 4])}" -assert reduce(lambda a, b: a + b, [1, 2, 3, 4]) == 10, f"reduce sum of [1, 2, 3, 4] should be 10, got {reduce(lambda a, b: a + b, [1, 2, 3, 4])}" +assert reduce(lambda a, b: a * b, [2, 3, 4]) == 24, ( + "product of [2, 3, 4] should be 24" +) +assert reduce(lambda a, b: a + b, [1, 2, 3, 4]) == 10, ( + "sum of [1, 2, 3, 4] should be 10" +) print("functional8 ✓") From 6319ef933a9faecba017891b8a3cc4b459a53400 Mon Sep 17 00:00:00 2001 From: mercael Date: Fri, 23 Oct 2026 19:33:15 +0300 Subject: [PATCH 6/8] Add actionable assertion messages to functional7, functional8 and functional9 checks Signed-off-by: mercael --- checks/functional/functional9.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/checks/functional/functional9.py b/checks/functional/functional9.py index 1f7b3cd..4a44c3a 100644 --- a/checks/functional/functional9.py +++ b/checks/functional/functional9.py @@ -1,8 +1,16 @@ assert has_negative is True, f"has_negative should be True, got {has_negative}" assert all_positive is True, f"all_positive should be True, got {all_positive}" -assert any(x < 0 for x in [1, 2, -3]) is True -assert any(x < 0 for x in [1, 2, 3]) is False -assert all(x > 0 for x in [1, 2, 3]) is True -assert all(x > 0 for x in [1, -2, 3]) is False +assert any(x < 0 for x in [1, 2, -3]) is True, ( + "any(x < 0 for x in [1, 2, -3]) should be True: -3 is negative" +) +assert any(x < 0 for x in [1, 2, 3]) is False, ( + "any(x < 0 for x in [1, 2, 3]) should be False: all are positive" +) +assert all(x > 0 for x in [1, 2, 3]) is True, ( + "all(x > 0 for x in [1, 2, 3]) should be True: all are positive" +) +assert all(x > 0 for x in [1, -2, 3]) is False, ( + "all(x > 0 for x in [1, -2, 3]) should be False: -2 is not > 0" +) print("functional9 ✓") From 88efe1f983aa8ff16db81e04742fa2ba9a772f44 Mon Sep 17 00:00:00 2001 From: mercael Date: Fri, 23 Oct 2026 19:33:17 +0300 Subject: [PATCH 7/8] Add actionable assertion messages to functional7, functional8 and functional9 checks Signed-off-by: mercael --- tests/test_functional_assertion_messages.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_functional_assertion_messages.py b/tests/test_functional_assertion_messages.py index ad04e9e..834d424 100644 --- a/tests/test_functional_assertion_messages.py +++ b/tests/test_functional_assertion_messages.py @@ -4,6 +4,8 @@ CHECKS_DIR = Path(__file__).resolve().parent.parent / "checks" / "functional" +BATCH = ("functional7.py", "functional8.py", "functional9.py") + def _asserts_without_message(path): tree = ast.parse(path.read_text(encoding="utf-8")) @@ -22,3 +24,20 @@ def test_functional7_asserts_have_messages(): def test_functional8_asserts_have_messages(): path = CHECKS_DIR / "functional8.py" assert _asserts_without_message(path) == [] + + +def test_functional9_asserts_have_messages(): + path = CHECKS_DIR / "functional9.py" + assert _asserts_without_message(path) == [] + + +def test_batch_lines_fit_eighty_columns(): + too_long = [ + f"{name}:{number} ({len(line)} columns)" + for name in BATCH + for number, line in enumerate( + (CHECKS_DIR / name).read_text(encoding="utf-8").splitlines(), 1 + ) + if len(line) > 80 + ] + assert too_long == [] From f0312057f89a520e90171a8c0a1ab55ac8d88930 Mon Sep 17 00:00:00 2001 From: Abhik Sarkar Date: Wed, 4 Nov 2026 13:20:41 +0530 Subject: [PATCH 8/8] style(curriculum): identify functional check and test file locations Add the required repository-relative path comments without changing execution behavior. Refs #87. --- checks/functional/functional7.py | 1 + checks/functional/functional8.py | 1 + checks/functional/functional9.py | 1 + tests/test_functional_assertion_messages.py | 1 + 4 files changed, 4 insertions(+) diff --git a/checks/functional/functional7.py b/checks/functional/functional7.py index ccc75c2..35a1794 100644 --- a/checks/functional/functional7.py +++ b/checks/functional/functional7.py @@ -1,3 +1,4 @@ +# checks/functional/functional7.py triple = make_multiplier(3) double = make_multiplier(2) diff --git a/checks/functional/functional8.py b/checks/functional/functional8.py index 4447352..5dc3fb7 100644 --- a/checks/functional/functional8.py +++ b/checks/functional/functional8.py @@ -1,3 +1,4 @@ +# checks/functional/functional8.py assert product == 120, f"product should be 120, got {product}" from functools import reduce diff --git a/checks/functional/functional9.py b/checks/functional/functional9.py index 4a44c3a..917060b 100644 --- a/checks/functional/functional9.py +++ b/checks/functional/functional9.py @@ -1,3 +1,4 @@ +# checks/functional/functional9.py assert has_negative is True, f"has_negative should be True, got {has_negative}" assert all_positive is True, f"all_positive should be True, got {all_positive}" diff --git a/tests/test_functional_assertion_messages.py b/tests/test_functional_assertion_messages.py index 834d424..70ed7d1 100644 --- a/tests/test_functional_assertion_messages.py +++ b/tests/test_functional_assertion_messages.py @@ -1,3 +1,4 @@ +# tests/test_functional_assertion_messages.py import ast from pathlib import Path