Skip to content

Commit f4a851a

Browse files
add run test
1 parent 2a1eb1c commit f4a851a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mypyc/test-data/run-strings.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ from datetime import datetime
416416
var = 'mypyc'
417417
num = 20
418418

419+
def final_value_setter() -> str:
420+
return 'hello'
421+
422+
final_var: Final = final_value_setter()
423+
419424
def test_fstring_basics() -> None:
420425
assert f'Hello {var}, this is a test' == "Hello mypyc, this is a test"
421426

@@ -451,6 +456,8 @@ def test_fstring_basics() -> None:
451456
inf_num = float('inf')
452457
assert f'{nan_num}, {inf_num}' == 'nan, inf'
453458

459+
assert f'{final_var}' == 'hello'
460+
454461
# F-strings would be translated into ''.join[string literals, format method call, ...] in mypy AST.
455462
# Currently we are using a str.join specializer for f-string speed up. We might not cover all cases
456463
# and the rest ones should fall back to a normal str.join method call.

0 commit comments

Comments
 (0)