File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -412,14 +412,16 @@ def test_basics() -> None:
412412[case testFStrings]
413413import decimal
414414from datetime import datetime
415+ from typing import Final
415416
416417var = 'mypyc'
417418num = 20
419+ final_known_at_compile_time: Final = 'hello'
418420
419421def final_value_setter() -> str:
420- return 'hello '
422+ return 'goodbye '
421423
422- final_var : Final = final_value_setter()
424+ final_unknown_at_compile_time : Final = final_value_setter()
423425
424426def test_fstring_basics() -> None:
425427 assert f'Hello {var}, this is a test' == "Hello mypyc, this is a test"
@@ -456,7 +458,7 @@ def test_fstring_basics() -> None:
456458 inf_num = float('inf')
457459 assert f'{nan_num}, {inf_num}' == 'nan, inf'
458460
459- assert f'{final_var} ' == 'hello'
461+ assert f'{final_known_at_compile_time} {final_unknown_at_compile_time} ' == 'hello goodbye '
460462
461463# F-strings would be translated into ''.join[string literals, format method call, ...] in mypy AST.
462464# Currently we are using a str.join specializer for f-string speed up. We might not cover all cases
You can’t perform that action at this time.
0 commit comments