@@ -254,6 +254,37 @@ def test_split(self):
254254 for arg , res in testcases :
255255 self .assertEqual (split (arg ), res , msg = arg )
256256
257+ def test_merge (self ):
258+ with support .check_warnings (('merge is deprecated' ,
259+ DeprecationWarning )):
260+ merge = self .interp .tk .merge
261+ call = self .interp .tk .call
262+ testcases = [
263+ ((), '' ),
264+ (('a' ,), 'a' ),
265+ ((2 ,), '2' ),
266+ (('' ,), '{}' ),
267+ ('{' , '\\ {' ),
268+ (('a' , 'b' , 'c' ), 'a b c' ),
269+ ((' ' , '\t ' , '\r ' , '\n ' ), '{ } {\t } {\r } {\n }' ),
270+ (('a' , ' ' , 'c' ), 'a { } c' ),
271+ (('a' , '€' ), 'a €' ),
272+ (('a' , '\U000104a2 ' ), 'a \U000104a2 ' ),
273+ (('a' , b'\xe2 \x82 \xac ' ), 'a €' ),
274+ (('a' , ('b' , 'c' )), 'a {b c}' ),
275+ (('a' , 2 ), 'a 2' ),
276+ (('a' , 3.4 ), 'a 3.4' ),
277+ (('a' , (2 , 3.4 )), 'a {2 3.4}' ),
278+ ((), '' ),
279+ ((call ('list' , 1 , '2' , (3.4 ,)),), '{1 2 3.4}' ),
280+ ((call ('dict' , 'create' , 12 , '\u20ac ' , b'\xe2 \x82 \xac ' , (3.4 ,)),),
281+ '{12 € € 3.4}' ),
282+ ]
283+ for args , res in testcases :
284+ self .assertEqual (merge (* args ), res , msg = args )
285+ self .assertRaises (UnicodeDecodeError , merge , b'\x80 ' )
286+ self .assertRaises (UnicodeEncodeError , merge , '\udc80 ' )
287+
257288
258289class BigmemTclTest (unittest .TestCase ):
259290
0 commit comments