mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
24 lines
480 B
Python
24 lines
480 B
Python
"""Test (edge case): accesses of object named `dict`."""
|
|
|
|
# OK
|
|
dict = {"parameters": {}}
|
|
dict["parameters"]["userId"] = "userId"
|
|
dict["parameters"]["itemId"] = "itemId"
|
|
del dict["parameters"]["itemId"]
|
|
|
|
# F821 Undefined name `key`
|
|
# F821 Undefined name `value`
|
|
x: dict["key", "value"]
|
|
|
|
# OK
|
|
x: dict[str, str]
|
|
|
|
# OK
|
|
def unimportant(name):
|
|
pass
|
|
|
|
|
|
def dang(dict, set, list):
|
|
unimportant(name=dict["name"])
|
|
unimportant(name=set["name"])
|
|
unimportant(name=list["name"])
|