File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed
graalpython/com.oracle.graal.python.test/src/tests Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change 55import unittest
66import string
77import sys
8+ from tests import util
89
910
1011class MyIndexable (object ):
@@ -1212,20 +1213,24 @@ def test_raw_unicode_escape_does_not_alter_encoded_string():
12121213 assert original == decoded
12131214
12141215
1215- def test_fstring ():
1216- class FunkyFormat :
1217- def __init__ (self , f ):
1218- self .f = f
1219- def __format__ (self , _ ):
1220- return self .f
1216+ class FunkyFormat :
1217+ def __init__ (self , f ):
1218+ self .f = f
1219+ def __format__ (self , _ ):
1220+ return self .f
1221+
1222+ class FunkyStr (str ):
1223+ def __str__ (self ):
1224+ return self
12211225
1222- class FunkyStr (str ):
1223- def __str__ (self ):
1224- return self
12251226
1227+ @util .skipUnlessBytecodeDSL ("bug in manual interpreter" )
1228+ def test_fstring_preserves_type_of_single_str ():
12261229 assert type (f"{ FunkyStr ('abc' )} " ) == FunkyStr
1227- assert type (f"hello { FunkyFormat ('world' )} !" ) == str
12281230
1231+
1232+ def test_fstring ():
1233+ assert type (f"hello { FunkyFormat ('world' )} !" ) == str
12291234 assert f"hello { FunkyFormat ('world' )} !" == "hello world!"
12301235 assert f"hello { FunkyStr ('world' )} !" == "hello world!"
12311236 assertRaises (TypeError , lambda : f"hello { FunkyFormat (33 )} !" )
You can’t perform that action at this time.
0 commit comments