Skip to content

Commit a7e5e42

Browse files
authored
[red-knot] Make attributes.md test future-proof (#14923)
## Summary Using `typing.LiteralString` breaks as soon as we understand `sys.version_info` branches, as it's only available in 3.11 and later. ## Test Plan Made sure it didn't fail on my #14759 branch anymore.
1 parent c361cf6 commit a7e5e42

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/red_knot_python_semantic/resources/mdtest/attributes.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ def _(flag: bool):
119119
## Objects of all types have a `__class__` method
120120

121121
```py
122-
import typing
122+
import typing_extensions
123123

124-
reveal_type(typing.__class__) # revealed: Literal[ModuleType]
124+
reveal_type(typing_extensions.__class__) # revealed: Literal[ModuleType]
125125

126126
a = 42
127127
reveal_type(a.__class__) # revealed: Literal[int]
@@ -138,7 +138,7 @@ reveal_type(d.__class__) # revealed: Literal[bool]
138138
e = (42, 42)
139139
reveal_type(e.__class__) # revealed: Literal[tuple]
140140

141-
def f(a: int, b: typing.LiteralString, c: int | str, d: type[str]):
141+
def f(a: int, b: typing_extensions.LiteralString, c: int | str, d: type[str]):
142142
reveal_type(a.__class__) # revealed: type[int]
143143
reveal_type(b.__class__) # revealed: Literal[str]
144144
reveal_type(c.__class__) # revealed: type[int] | type[str]

0 commit comments

Comments
 (0)