From d6702b45dff572f9616b60511322c47a670ad2c2 Mon Sep 17 00:00:00 2001 From: proofcheck-e2e Date: Tue, 13 Oct 2026 19:06:50 -0400 Subject: [PATCH] proofcheck e2e: [proofcheck e2e] Fix clamp upper bound --- e2e_toy/tests/test_textops.py | 3 +++ e2e_toy/textops.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/e2e_toy/tests/test_textops.py b/e2e_toy/tests/test_textops.py index e05680d..fc30909 100644 --- a/e2e_toy/tests/test_textops.py +++ b/e2e_toy/tests/test_textops.py @@ -23,6 +23,9 @@ def test_inside(self): def test_below(self): self.assertEqual(clamp(-3, 0, 10), 0) + def test_at_upper_bound(self): + self.assertEqual(clamp(10, 0, 10), 10) + class ChunkTest(unittest.TestCase): def test_even(self): diff --git a/e2e_toy/textops.py b/e2e_toy/textops.py index 8f71f6c..57feb8d 100644 --- a/e2e_toy/textops.py +++ b/e2e_toy/textops.py @@ -19,8 +19,9 @@ def clamp(value, low, high): """Limit ``value`` to the closed range [low, high].""" if value < low: return low - if value > high: - return value + if value >= high: + # Values at or above the upper bound are handled here. + return max(value, high) return value