diff --git a/pipeline_test.py b/pipeline_test.py index 39fe177..e502b96 100644 --- a/pipeline_test.py +++ b/pipeline_test.py @@ -1,7 +1,7 @@ """A small arithmetic calculator. Provides the :func:`calculate` function which performs basic arithmetic -operations (+, -, *, /, **, ^, //, %) with proper error handling. +operations (+, -, *, /, **, ^, //, %, min, max) with proper error handling. """ __all__ = ["calculate"] @@ -17,7 +17,7 @@ def calculate(a: float, op: str, b: float) -> int | float: Args: a: First operand - op: Operation (+, -, *, /, **, ^, //, %) + op: Operation (+, -, *, /, **, ^, //, %, min, max) b: Second operand Returns: @@ -56,5 +56,9 @@ def calculate(a: float, op: str, b: float) -> int | float: return a // b case "%": return a % b + case "min": + return min(a, b) + case "max": + return max(a, b) case _: raise ValueError(f"unknown operation: {op!r}") diff --git a/test_pipeline.py b/test_pipeline.py index 6b5ef74..2095071 100644 --- a/test_pipeline.py +++ b/test_pipeline.py @@ -16,6 +16,8 @@ from pipeline_test import calculate (2, "^", 3, 8), (7, "//", 2, 3), (7, "%", 2, 1), + (3, "min", 7, 3), + (3, "max", 7, 7), ], ) def test_operations(a, op, b, expected):