File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,11 @@ from datetime import datetime
416416var = 'mypyc'
417417num = 20
418418
419+ def final_value_setter() -> str:
420+ return 'hello'
421+
422+ final_var: Final = final_value_setter()
423+
419424def 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.
You can’t perform that action at this time.
0 commit comments