-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee8a4ed
commit ba0a46d
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[case acceptFstringWithoutSpecs] | ||
[builtins fixtures/f_string.pyi] | ||
reveal_type(f"{123} {True} {1 + 2} {'foo'}") # N: Revealed type is "builtins.str" | ||
|
||
[case acceptFstringWithValidSpecs] | ||
[builtins fixtures/f_string.pyi] | ||
f"{123:+04} {True!r} {1 + 2:+} {'foo':3<}" | ||
|
||
[case denyFstringsWithInvalidSpecs] | ||
[builtins fixtures/f_string.pyi] | ||
f"{'hi':+}" # E: Numeric flags are only allowed for numeric types | ||
f"{123:foo}" # E: Unrecognized format specification "foo" | ||
|
||
class MyClass: | ||
pass | ||
|
||
f"{MyClass:abc}" # E: Unrecognized format specification "abc" | ||
|
||
|
||
f"{1} {2} {3:x} {4:y} {5:z}" # E: Unsupported format character "y" # E: Unsupported format character "z" |