From e76716bc23bd6593486eb9fbb8d9ed67e2ce4f86 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:20:55 +0000 Subject: [PATCH 1/2] Initial plan From c29bbb9f85d6a55a94b898f17fdf2738e4370af2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 17:29:07 +0000 Subject: [PATCH 2/2] Fix rich comparison NotImplemented handling Co-authored-by: intjelic <778121+intjelic@users.noreply.github.com> Agent-Logs-Url: https://github.com/intjelic/python-sfml/sessions/344dfea0-32f6-4e5b-8a9b-32f4e25fc600 --- src/sfml/graphics/graphics.pyx | 2 +- tests/test_graphics_module.py | 16 ++++++++++++++++ tests/test_system_module.py | 17 ++++++++++++++--- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/sfml/graphics/graphics.pyx b/src/sfml/graphics/graphics.pyx index 7dccfd8..15c2737 100644 --- a/src/sfml/graphics/graphics.pyx +++ b/src/sfml/graphics/graphics.pyx @@ -569,7 +569,7 @@ cdef public class Rect[type PyRectType, object PyRectObject]: elif op == 3: return tuple(self) != tuple(other) else: - raise NotImplemented + return NotImplemented def __iter__(self): return iter((self.left, self.top, self.width, self.height)) diff --git a/tests/test_graphics_module.py b/tests/test_graphics_module.py index 04d4979..09221a7 100644 --- a/tests/test_graphics_module.py +++ b/tests/test_graphics_module.py @@ -74,6 +74,22 @@ def test_rect_color_and_transform_behaviors_are_deterministic(): assert transform.rotate(15) is transform +def test_rect_ordering_is_not_supported(): + left = sf.Rect((0, 0), (4, 4)) + right = sf.Rect((0, 0), (4, 4)) + + assert left == right + assert not (left != right) + + with pytest.raises(TypeError) as excinfo: + left > right + + message = str(excinfo.value) + assert "not supported" in message + assert "Rect" in message + assert "BaseException" not in message + + def test_render_texture_uses_explicit_activation_api_and_exposes_texture(): render_texture = sf.RenderTexture(8, 8) diff --git a/tests/test_system_module.py b/tests/test_system_module.py index 06a1cba..6156053 100644 --- a/tests/test_system_module.py +++ b/tests/test_system_module.py @@ -78,8 +78,19 @@ def test_vector2_inplace_operations(): def test_vector2_ordering_is_not_supported(): - with pytest.raises(TypeError): - sf.Vector2(1, 2) < sf.Vector2(2, 3) + left = sf.Vector2(1, 2) + right = sf.Vector2(1, 2) + + assert left == right + assert not (left != right) + + with pytest.raises(TypeError) as excinfo: + left > right + + message = str(excinfo.value) + assert "not supported" in message + assert "Vector2" in message + assert "BaseException" not in message def test_vector3_sequence_interop_and_scalar_arithmetic(): @@ -192,4 +203,4 @@ def test_angle_arithmetic_and_inplace_operations(): assert angle.degrees == pytest.approx(40.0) angle %= sf.degrees(15) - assert angle.degrees == pytest.approx(10.0) \ No newline at end of file + assert angle.degrees == pytest.approx(10.0)