Skip to content

Commit 44e9353

Browse files
add check tests
1 parent 6548995 commit 44e9353

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

test-data/unit/check-formatting.test

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,27 @@ a = None # type: Any
103103
[typing fixtures/typing-medium.pyi]
104104

105105
[case testStringInterpolationC]
106+
from typing import Final
107+
108+
final_int: Final = 1
109+
final_float: Final = 1.0
110+
final_char_string: Final = 's'
111+
final_empty_string: Final = ''
112+
final_string: Final = 'ab'
113+
106114
'%c' % 1
107-
'%c' % 1.0 # E: "%c" requires int or char (expression has type "float")
115+
'%c' % final_int
116+
'%c' % 1.0 # E: "%c" requires int or char (expression has type "float")
117+
'%c' % final_float # E: "%c" requires int or char (expression has type "float")
108118
'%c' % 's'
109-
'%c' % '' # E: "%c" requires int or char
110-
'%c' % 'ab' # E: "%c" requires int or char
111-
'%c' % b'a' # E: "%c" requires int or char (expression has type "bytes")
112-
'%c' % b'' # E: "%c" requires int or char (expression has type "bytes")
113-
'%c' % b'ab' # E: "%c" requires int or char (expression has type "bytes")
119+
'%c' % final_char_string
120+
'%c' % '' # E: "%c" requires int or char
121+
'%c' % final_empty_string # E: "%c" requires int or char
122+
'%c' % 'ab' # E: "%c" requires int or char
123+
'%c' % final_string # E: "%c" requires int or char
124+
'%c' % b'a' # E: "%c" requires int or char (expression has type "bytes")
125+
'%c' % b'' # E: "%c" requires int or char (expression has type "bytes")
126+
'%c' % b'ab' # E: "%c" requires int or char (expression has type "bytes")
114127
[builtins fixtures/primitives.pyi]
115128

116129
[case testStringInterpolationMappingTypes]

0 commit comments

Comments
 (0)