From 3162cd1a0a8d9758c5ff2af82169ceadfd813612 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 08:17:41 +0000 Subject: [PATCH 1/4] Initial plan From b6893e7ff5531f0cda48473543459bf0a7c85ebc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 08:24:00 +0000 Subject: [PATCH 2/4] Add tests for intern_atom and atom caching mechanism Co-authored-by: jholveck <240807535+jholveck@users.noreply.github.com> --- src/tests/test_xcb.py | 150 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) diff --git a/src/tests/test_xcb.py b/src/tests/test_xcb.py index 24903ace..6dc3b12b 100644 --- a/src/tests/test_xcb.py +++ b/src/tests/test_xcb.py @@ -224,6 +224,156 @@ def visual_validation_env(monkeypatch: pytest.MonkeyPatch) -> _VisualValidationH return _VisualValidationHarness(monkeypatch) +#### intern_atom tests + + +def _make_fake_lib_for_intern_atom(atom_value: int) -> SimpleNamespace: + """Return a minimal fake LIB whose xcb_intern_atom returns the given atom value.""" + fake_reply = SimpleNamespace(atom=SimpleNamespace(value=atom_value)) + fake_cookie = Mock() + fake_cookie.reply.return_value = fake_reply + return SimpleNamespace(xcb=SimpleNamespace(xcb_intern_atom=Mock(return_value=fake_cookie))) + + +def test_intern_atom_returns_predefined_atom() -> None: + """intern_atom returns predefined atoms directly without calling XCB.""" + conn = xcb.Connection() + atom = xcb.intern_atom(conn, "PRIMARY") + assert atom == xcb.Atom(1) + + +def test_intern_atom_cache_miss_calls_xcb(monkeypatch: pytest.MonkeyPatch) -> None: + """intern_atom calls XCB for non-predefined atoms not yet in the cache.""" + conn = xcb.Connection() + cache_key = addressof(conn) + xcb._ATOM_CACHE[cache_key] = {} + fake_lib = _make_fake_lib_for_intern_atom(100) + monkeypatch.setattr(xcb, "LIB", fake_lib) + try: + atom = xcb.intern_atom(conn, "_NET_WM_NAME") + assert atom == xcb.Atom(100) + fake_lib.xcb.xcb_intern_atom.assert_called_once() + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_intern_atom_cache_hit_skips_xcb(monkeypatch: pytest.MonkeyPatch) -> None: + """intern_atom returns a cached atom without calling XCB again.""" + conn = xcb.Connection() + cache_key = addressof(conn) + expected_atom = xcb.Atom(100) + xcb._ATOM_CACHE[cache_key] = {"_NET_WM_NAME": expected_atom} + fake_lib = SimpleNamespace(xcb=SimpleNamespace(xcb_intern_atom=Mock())) + monkeypatch.setattr(xcb, "LIB", fake_lib) + try: + atom = xcb.intern_atom(conn, "_NET_WM_NAME") + assert atom == expected_atom + fake_lib.xcb.xcb_intern_atom.assert_not_called() + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_intern_atom_caches_result_after_xcb_call(monkeypatch: pytest.MonkeyPatch) -> None: + """intern_atom stores the fetched atom in the cache.""" + conn = xcb.Connection() + cache_key = addressof(conn) + xcb._ATOM_CACHE[cache_key] = {} + fake_lib = _make_fake_lib_for_intern_atom(200) + monkeypatch.setattr(xcb, "LIB", fake_lib) + try: + xcb.intern_atom(conn, "_NET_WM_NAME") + assert xcb._ATOM_CACHE[cache_key].get("_NET_WM_NAME") == xcb.Atom(200) + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_intern_atom_only_if_exists_returns_none_when_not_found(monkeypatch: pytest.MonkeyPatch) -> None: + """intern_atom returns None when only_if_exists=True and the atom is absent.""" + conn = xcb.Connection() + cache_key = addressof(conn) + xcb._ATOM_CACHE[cache_key] = {} + fake_lib = _make_fake_lib_for_intern_atom(0) + monkeypatch.setattr(xcb, "LIB", fake_lib) + try: + atom = xcb.intern_atom(conn, "_NET_NONEXISTENT", only_if_exists=True) + assert atom is None + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_intern_atom_raises_when_not_found_and_only_if_exists_false(monkeypatch: pytest.MonkeyPatch) -> None: + """intern_atom raises XError when the atom is not found and only_if_exists=False.""" + conn = xcb.Connection() + cache_key = addressof(conn) + xcb._ATOM_CACHE[cache_key] = {} + fake_lib = _make_fake_lib_for_intern_atom(0) + monkeypatch.setattr(xcb, "LIB", fake_lib) + try: + with pytest.raises(xcb.XError, match="X server failed to intern atom"): + xcb.intern_atom(conn, "_NET_NONEXISTENT") + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_intern_atom_accepts_pointer_connection(monkeypatch: pytest.MonkeyPatch) -> None: + """intern_atom correctly dereferences a pointer to a Connection.""" + conn = xcb.Connection() + conn_ptr = pointer(conn) + cache_key = addressof(conn) + xcb._ATOM_CACHE[cache_key] = {} + fake_lib = _make_fake_lib_for_intern_atom(300) + monkeypatch.setattr(xcb, "LIB", fake_lib) + try: + atom = xcb.intern_atom(conn_ptr, "_NET_WM_STATE") + assert atom == xcb.Atom(300) + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_connect_initializes_atom_cache(monkeypatch: pytest.MonkeyPatch) -> None: + """connect() adds an empty atom cache entry for the new connection.""" + conn = xcb.Connection() + conn_ptr = pointer(conn) + cache_key = addressof(conn) + fake_lib = SimpleNamespace( + xcb=SimpleNamespace( + xcb_connect=Mock(return_value=conn_ptr), + xcb_connection_has_error=Mock(return_value=0), + xcb_disconnect=Mock(), + xcb_prefetch_extension_data=Mock(), + ), + randr_id=XcbExtension(), + render_id=XcbExtension(), + shm_id=XcbExtension(), + xfixes_id=XcbExtension(), + ) + monkeypatch.setattr(xcb, "LIB", fake_lib) + monkeypatch.setattr(xcb, "initialize", lambda: None) + assert cache_key not in xcb._ATOM_CACHE + try: + xcb.connect() + assert cache_key in xcb._ATOM_CACHE + assert xcb._ATOM_CACHE[cache_key] == {} + finally: + xcb._ATOM_CACHE.pop(cache_key, None) + + +def test_disconnect_clears_atom_cache(monkeypatch: pytest.MonkeyPatch) -> None: + """disconnect() removes the atom cache entry for the connection.""" + conn = xcb.Connection() + cache_key = addressof(conn) + xcb._ATOM_CACHE[cache_key] = {"_NET_WM_NAME": xcb.Atom(100)} + fake_lib = SimpleNamespace( + xcb=SimpleNamespace( + xcb_connection_has_error=Mock(return_value=0), + xcb_disconnect=Mock(), + ) + ) + monkeypatch.setattr(xcb, "LIB", fake_lib) + xcb.disconnect(conn) + assert cache_key not in xcb._ATOM_CACHE + + def test_xgetimage_visual_validation_accepts_default_setup(visual_validation_env: _VisualValidationHarness) -> None: visual_validation_env.reset() mss_instance = xgetimage.MSS() From 415fcde46a63bcd02c9d6c9d8db79a39d579dd93 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 09:06:28 +0000 Subject: [PATCH 3/4] Refactor intern_atom tests into a class with shared setup Co-authored-by: jholveck <240807535+jholveck@users.noreply.github.com> --- src/tests/test_xcb.py | 165 +++++++++++++----------------------------- 1 file changed, 50 insertions(+), 115 deletions(-) diff --git a/src/tests/test_xcb.py b/src/tests/test_xcb.py index 6dc3b12b..d989e720 100644 --- a/src/tests/test_xcb.py +++ b/src/tests/test_xcb.py @@ -12,10 +12,13 @@ sizeof, ) from types import SimpleNamespace -from typing import Any, Callable +from typing import TYPE_CHECKING, Any, Callable from unittest.mock import Mock from weakref import finalize +if TYPE_CHECKING: + from collections.abc import Generator + import pytest from mss.exception import ScreenShotError @@ -227,111 +230,59 @@ def visual_validation_env(monkeypatch: pytest.MonkeyPatch) -> _VisualValidationH #### intern_atom tests -def _make_fake_lib_for_intern_atom(atom_value: int) -> SimpleNamespace: - """Return a minimal fake LIB whose xcb_intern_atom returns the given atom value.""" - fake_reply = SimpleNamespace(atom=SimpleNamespace(value=atom_value)) - fake_cookie = Mock() - fake_cookie.reply.return_value = fake_reply - return SimpleNamespace(xcb=SimpleNamespace(xcb_intern_atom=Mock(return_value=fake_cookie))) - - -def test_intern_atom_returns_predefined_atom() -> None: - """intern_atom returns predefined atoms directly without calling XCB.""" - conn = xcb.Connection() - atom = xcb.intern_atom(conn, "PRIMARY") - assert atom == xcb.Atom(1) - - -def test_intern_atom_cache_miss_calls_xcb(monkeypatch: pytest.MonkeyPatch) -> None: - """intern_atom calls XCB for non-predefined atoms not yet in the cache.""" - conn = xcb.Connection() - cache_key = addressof(conn) - xcb._ATOM_CACHE[cache_key] = {} - fake_lib = _make_fake_lib_for_intern_atom(100) - monkeypatch.setattr(xcb, "LIB", fake_lib) - try: - atom = xcb.intern_atom(conn, "_NET_WM_NAME") +class TestInternAtom: + """Tests for xcb.intern_atom and the _ATOM_CACHE mechanism.""" + + @pytest.fixture(autouse=True) + def setup_intern_atom(self, monkeypatch: pytest.MonkeyPatch) -> Generator[None, None, None]: + self.conn = xcb.Connection() + self.cache_key = addressof(self.conn) + xcb._ATOM_CACHE[self.cache_key] = {} + self._fake_reply = SimpleNamespace(atom=SimpleNamespace(value=0)) + fake_cookie = Mock() + fake_cookie.reply.return_value = self._fake_reply + self.xcb_intern_atom = Mock(return_value=fake_cookie) + monkeypatch.setattr(xcb, "LIB", SimpleNamespace(xcb=SimpleNamespace(xcb_intern_atom=self.xcb_intern_atom))) + yield + xcb._ATOM_CACHE.pop(self.cache_key, None) + + def _set_atom_value(self, value: int) -> None: + self._fake_reply.atom.value = value + + def test_predefined_atom_skips_xcb(self) -> None: + atom = xcb.intern_atom(self.conn, "PRIMARY") + assert atom == xcb.Atom(1) + self.xcb_intern_atom.assert_not_called() + + def test_cache_miss_calls_xcb_and_caches_result(self) -> None: + self._set_atom_value(100) + atom = xcb.intern_atom(self.conn, "_NET_WM_NAME") assert atom == xcb.Atom(100) - fake_lib.xcb.xcb_intern_atom.assert_called_once() - finally: - xcb._ATOM_CACHE.pop(cache_key, None) - - -def test_intern_atom_cache_hit_skips_xcb(monkeypatch: pytest.MonkeyPatch) -> None: - """intern_atom returns a cached atom without calling XCB again.""" - conn = xcb.Connection() - cache_key = addressof(conn) - expected_atom = xcb.Atom(100) - xcb._ATOM_CACHE[cache_key] = {"_NET_WM_NAME": expected_atom} - fake_lib = SimpleNamespace(xcb=SimpleNamespace(xcb_intern_atom=Mock())) - monkeypatch.setattr(xcb, "LIB", fake_lib) - try: - atom = xcb.intern_atom(conn, "_NET_WM_NAME") - assert atom == expected_atom - fake_lib.xcb.xcb_intern_atom.assert_not_called() - finally: - xcb._ATOM_CACHE.pop(cache_key, None) - - -def test_intern_atom_caches_result_after_xcb_call(monkeypatch: pytest.MonkeyPatch) -> None: - """intern_atom stores the fetched atom in the cache.""" - conn = xcb.Connection() - cache_key = addressof(conn) - xcb._ATOM_CACHE[cache_key] = {} - fake_lib = _make_fake_lib_for_intern_atom(200) - monkeypatch.setattr(xcb, "LIB", fake_lib) - try: - xcb.intern_atom(conn, "_NET_WM_NAME") - assert xcb._ATOM_CACHE[cache_key].get("_NET_WM_NAME") == xcb.Atom(200) - finally: - xcb._ATOM_CACHE.pop(cache_key, None) + self.xcb_intern_atom.assert_called_once() + assert xcb._ATOM_CACHE[self.cache_key]["_NET_WM_NAME"] == xcb.Atom(100) + def test_cache_hit_skips_xcb(self) -> None: + xcb._ATOM_CACHE[self.cache_key]["_NET_WM_NAME"] = xcb.Atom(100) + atom = xcb.intern_atom(self.conn, "_NET_WM_NAME") + assert atom == xcb.Atom(100) + self.xcb_intern_atom.assert_not_called() -def test_intern_atom_only_if_exists_returns_none_when_not_found(monkeypatch: pytest.MonkeyPatch) -> None: - """intern_atom returns None when only_if_exists=True and the atom is absent.""" - conn = xcb.Connection() - cache_key = addressof(conn) - xcb._ATOM_CACHE[cache_key] = {} - fake_lib = _make_fake_lib_for_intern_atom(0) - monkeypatch.setattr(xcb, "LIB", fake_lib) - try: - atom = xcb.intern_atom(conn, "_NET_NONEXISTENT", only_if_exists=True) + def test_only_if_exists_returns_none_when_missing(self) -> None: + atom = xcb.intern_atom(self.conn, "_NET_NONEXISTENT", only_if_exists=True) assert atom is None - finally: - xcb._ATOM_CACHE.pop(cache_key, None) - -def test_intern_atom_raises_when_not_found_and_only_if_exists_false(monkeypatch: pytest.MonkeyPatch) -> None: - """intern_atom raises XError when the atom is not found and only_if_exists=False.""" - conn = xcb.Connection() - cache_key = addressof(conn) - xcb._ATOM_CACHE[cache_key] = {} - fake_lib = _make_fake_lib_for_intern_atom(0) - monkeypatch.setattr(xcb, "LIB", fake_lib) - try: + def test_raises_when_missing_and_not_only_if_exists(self) -> None: with pytest.raises(xcb.XError, match="X server failed to intern atom"): - xcb.intern_atom(conn, "_NET_NONEXISTENT") - finally: - xcb._ATOM_CACHE.pop(cache_key, None) - + xcb.intern_atom(self.conn, "_NET_NONEXISTENT") -def test_intern_atom_accepts_pointer_connection(monkeypatch: pytest.MonkeyPatch) -> None: - """intern_atom correctly dereferences a pointer to a Connection.""" - conn = xcb.Connection() - conn_ptr = pointer(conn) - cache_key = addressof(conn) - xcb._ATOM_CACHE[cache_key] = {} - fake_lib = _make_fake_lib_for_intern_atom(300) - monkeypatch.setattr(xcb, "LIB", fake_lib) - try: - atom = xcb.intern_atom(conn_ptr, "_NET_WM_STATE") + def test_pointer_connection_uses_correct_cache_key(self) -> None: + self._set_atom_value(300) + atom = xcb.intern_atom(pointer(self.conn), "_NET_WM_STATE") assert atom == xcb.Atom(300) - finally: - xcb._ATOM_CACHE.pop(cache_key, None) -def test_connect_initializes_atom_cache(monkeypatch: pytest.MonkeyPatch) -> None: - """connect() adds an empty atom cache entry for the new connection.""" +def test_atom_cache_lifecycle(monkeypatch: pytest.MonkeyPatch) -> None: + """connect() initializes and disconnect() clears the per-connection atom cache entry.""" conn = xcb.Connection() conn_ptr = pointer(conn) cache_key = addressof(conn) @@ -349,27 +300,11 @@ def test_connect_initializes_atom_cache(monkeypatch: pytest.MonkeyPatch) -> None ) monkeypatch.setattr(xcb, "LIB", fake_lib) monkeypatch.setattr(xcb, "initialize", lambda: None) - assert cache_key not in xcb._ATOM_CACHE - try: - xcb.connect() - assert cache_key in xcb._ATOM_CACHE - assert xcb._ATOM_CACHE[cache_key] == {} - finally: - xcb._ATOM_CACHE.pop(cache_key, None) + assert cache_key not in xcb._ATOM_CACHE + xcb.connect() + assert xcb._ATOM_CACHE.get(cache_key) == {} -def test_disconnect_clears_atom_cache(monkeypatch: pytest.MonkeyPatch) -> None: - """disconnect() removes the atom cache entry for the connection.""" - conn = xcb.Connection() - cache_key = addressof(conn) - xcb._ATOM_CACHE[cache_key] = {"_NET_WM_NAME": xcb.Atom(100)} - fake_lib = SimpleNamespace( - xcb=SimpleNamespace( - xcb_connection_has_error=Mock(return_value=0), - xcb_disconnect=Mock(), - ) - ) - monkeypatch.setattr(xcb, "LIB", fake_lib) xcb.disconnect(conn) assert cache_key not in xcb._ATOM_CACHE From 362c124b0eec14f3b9486118992652c8d780abf1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Feb 2026 09:29:02 +0000 Subject: [PATCH 4/4] Use real XCB connections in intern_atom tests Co-authored-by: jholveck <240807535+jholveck@users.noreply.github.com> --- src/tests/test_xcb.py | 85 +++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 48 deletions(-) diff --git a/src/tests/test_xcb.py b/src/tests/test_xcb.py index d989e720..a498434c 100644 --- a/src/tests/test_xcb.py +++ b/src/tests/test_xcb.py @@ -234,79 +234,68 @@ class TestInternAtom: """Tests for xcb.intern_atom and the _ATOM_CACHE mechanism.""" @pytest.fixture(autouse=True) - def setup_intern_atom(self, monkeypatch: pytest.MonkeyPatch) -> Generator[None, None, None]: - self.conn = xcb.Connection() - self.cache_key = addressof(self.conn) - xcb._ATOM_CACHE[self.cache_key] = {} - self._fake_reply = SimpleNamespace(atom=SimpleNamespace(value=0)) - fake_cookie = Mock() - fake_cookie.reply.return_value = self._fake_reply - self.xcb_intern_atom = Mock(return_value=fake_cookie) - monkeypatch.setattr(xcb, "LIB", SimpleNamespace(xcb=SimpleNamespace(xcb_intern_atom=self.xcb_intern_atom))) + def setup_intern_atom(self) -> Generator[None, None, None]: + self.conn, _ = xcb.connect() yield - xcb._ATOM_CACHE.pop(self.cache_key, None) + xcb.disconnect(self.conn) - def _set_atom_value(self, value: int) -> None: - self._fake_reply.atom.value = value + def _mock_xcb_intern_atom(self, monkeypatch: pytest.MonkeyPatch, atom_value: int) -> Mock: + """Patch LIB.xcb.xcb_intern_atom to return a fake reply with the given atom value.""" + fake_reply = SimpleNamespace(atom=SimpleNamespace(value=atom_value)) + fake_cookie = Mock() + fake_cookie.reply.return_value = fake_reply + mock = Mock(return_value=fake_cookie) + monkeypatch.setattr(xcb.LIB.xcb, "xcb_intern_atom", mock) + return mock - def test_predefined_atom_skips_xcb(self) -> None: + def test_predefined_atom_skips_xcb(self, monkeypatch: pytest.MonkeyPatch) -> None: + mock = self._mock_xcb_intern_atom(monkeypatch, 0) atom = xcb.intern_atom(self.conn, "PRIMARY") assert atom == xcb.Atom(1) - self.xcb_intern_atom.assert_not_called() + mock.assert_not_called() - def test_cache_miss_calls_xcb_and_caches_result(self) -> None: - self._set_atom_value(100) + def test_cache_miss_calls_xcb_and_caches_result(self, monkeypatch: pytest.MonkeyPatch) -> None: + mock = self._mock_xcb_intern_atom(monkeypatch, 100) + cache_key = addressof(self.conn) atom = xcb.intern_atom(self.conn, "_NET_WM_NAME") assert atom == xcb.Atom(100) - self.xcb_intern_atom.assert_called_once() - assert xcb._ATOM_CACHE[self.cache_key]["_NET_WM_NAME"] == xcb.Atom(100) + mock.assert_called_once() + assert xcb._ATOM_CACHE[cache_key]["_NET_WM_NAME"] == xcb.Atom(100) - def test_cache_hit_skips_xcb(self) -> None: - xcb._ATOM_CACHE[self.cache_key]["_NET_WM_NAME"] = xcb.Atom(100) + def test_cache_hit_skips_xcb(self, monkeypatch: pytest.MonkeyPatch) -> None: + mock = self._mock_xcb_intern_atom(monkeypatch, 0) + # xcb.connect() in setup_intern_atom guarantees a cache entry for self.conn. + xcb._ATOM_CACHE[addressof(self.conn)]["_NET_WM_NAME"] = xcb.Atom(100) atom = xcb.intern_atom(self.conn, "_NET_WM_NAME") assert atom == xcb.Atom(100) - self.xcb_intern_atom.assert_not_called() + mock.assert_not_called() def test_only_if_exists_returns_none_when_missing(self) -> None: - atom = xcb.intern_atom(self.conn, "_NET_NONEXISTENT", only_if_exists=True) + atom = xcb.intern_atom(self.conn, "_MSS_TEST_NONEXISTENT_ATOM_12345", only_if_exists=True) assert atom is None - def test_raises_when_missing_and_not_only_if_exists(self) -> None: + def test_raises_when_missing_and_not_only_if_exists(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Exercises the "shouldn't be possible" code path where the server returns 0 with only_if_exists=False. + self._mock_xcb_intern_atom(monkeypatch, 0) with pytest.raises(xcb.XError, match="X server failed to intern atom"): xcb.intern_atom(self.conn, "_NET_NONEXISTENT") def test_pointer_connection_uses_correct_cache_key(self) -> None: - self._set_atom_value(300) - atom = xcb.intern_atom(pointer(self.conn), "_NET_WM_STATE") - assert atom == xcb.Atom(300) + atom = xcb.intern_atom(pointer(self.conn), "_NET_WM_NAME") + assert atom is not None + assert addressof(self.conn) in xcb._ATOM_CACHE -def test_atom_cache_lifecycle(monkeypatch: pytest.MonkeyPatch) -> None: +def test_atom_cache_lifecycle() -> None: """connect() initializes and disconnect() clears the per-connection atom cache entry.""" - conn = xcb.Connection() - conn_ptr = pointer(conn) + before = set(xcb._ATOM_CACHE) + conn, _ = xcb.connect() cache_key = addressof(conn) - fake_lib = SimpleNamespace( - xcb=SimpleNamespace( - xcb_connect=Mock(return_value=conn_ptr), - xcb_connection_has_error=Mock(return_value=0), - xcb_disconnect=Mock(), - xcb_prefetch_extension_data=Mock(), - ), - randr_id=XcbExtension(), - render_id=XcbExtension(), - shm_id=XcbExtension(), - xfixes_id=XcbExtension(), - ) - monkeypatch.setattr(xcb, "LIB", fake_lib) - monkeypatch.setattr(xcb, "initialize", lambda: None) - - assert cache_key not in xcb._ATOM_CACHE - xcb.connect() - assert xcb._ATOM_CACHE.get(cache_key) == {} - + assert cache_key in xcb._ATOM_CACHE + assert xcb._ATOM_CACHE[cache_key] == {} xcb.disconnect(conn) assert cache_key not in xcb._ATOM_CACHE + assert set(xcb._ATOM_CACHE) == before def test_xgetimage_visual_validation_accepts_default_setup(visual_validation_env: _VisualValidationHarness) -> None: