diff --git a/src/trio/_tests/test_exports.py b/src/trio/_tests/test_exports.py index 7d8a7e3c0..830fd78d8 100644 --- a/src/trio/_tests/test_exports.py +++ b/src/trio/_tests/test_exports.py @@ -384,8 +384,11 @@ def lookup_symbol(symbol: str) -> dict[str, str]: elif tool == "mypy": # load the cached type information cached_type_info = cache_json["names"][class_name] - if "node" not in cached_type_info: - cached_type_info = lookup_symbol(cached_type_info["cross_ref"]) + # previously this was an 'if' but it seems it's no longer possible + # for this cache to contain 'node', if this assert raises for you + # please let us know! + assert "node" not in cached_type_info + cached_type_info = lookup_symbol(cached_type_info["cross_ref"]) assert "node" in cached_type_info node = cached_type_info["node"]