Skip to content

Commit

Permalink
assert there's no node in cached_type_info
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Dec 20, 2024
1 parent 95b1f75 commit becdf2a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit becdf2a

Please sign in to comment.