@@ -312,12 +312,16 @@ def test_common_format(self):
312312 "not enough arguments for format string (got 0)" )
313313 test_exc_common ('%(x)r' , 1 , TypeError ,
314314 "format requires a mapping, not int" )
315+ test_exc_common ('%*r' , 1 , TypeError ,
316+ "not enough arguments for format string (got 1)" )
315317 test_exc_common ('%*r' , 3.14 , TypeError ,
316- "* requires int, not float " )
318+ "not enough arguments for format string (got 1) " )
317319 test_exc_common ('%*r' , (3.14 , 1 ), TypeError ,
318320 "format argument 1: * requires int, not float" )
321+ test_exc_common ('%.*r' , 1 , TypeError ,
322+ "not enough arguments for format string (got 1)" )
319323 test_exc_common ('%.*r' , 3.14 , TypeError ,
320- "* requires int, not float " )
324+ "not enough arguments for format string (got 1) " )
321325 test_exc_common ('%.*r' , (3.14 , 1 ), TypeError ,
322326 "format argument 1: * requires int, not float" )
323327 test_exc_common ('%*r' , (2 ** 1000 , 1 ), OverflowError ,
@@ -329,25 +333,25 @@ def test_common_format(self):
329333 test_exc_common ('%.*r' , (- 2 ** 1000 , 1 ), OverflowError ,
330334 "format argument 1: too big for precision" )
331335 test_exc_common ('%d' , '1' , TypeError ,
332- "a real number is required for format %d , not str" )
336+ "%d requires a real number, not str" )
333337 test_exc_common ('%d' , b'1' , TypeError ,
334- "a real number is required for format %d , not bytes" )
338+ "%d requires a real number, not bytes" )
335339 test_exc_common ('%d' , ('1' ,), TypeError ,
336- "format argument 1: a real number is required for format %d , not str" )
340+ "format argument 1: %d requires a real number, not str" )
337341 test_exc_common ('%x' , '1' , TypeError ,
338- "an integer is required for format %x , not str" )
342+ "%x requires an integer , not str" )
339343 test_exc_common ('%x' , 3.14 , TypeError ,
340- "an integer is required for format %x , not float" )
344+ "%x requires an integer , not float" )
341345 test_exc_common ('%x' , ('1' ,), TypeError ,
342- "format argument 1: an integer is required for format %x , not str" )
346+ "format argument 1: %x requires an integer , not str" )
343347 test_exc_common ('%i' , '1' , TypeError ,
344- "a real number is required for format %i , not str" )
348+ "%i requires a real number, not str" )
345349 test_exc_common ('%i' , b'1' , TypeError ,
346- "a real number is required for format %i , not bytes" )
350+ "%i requires a real number, not bytes" )
347351 test_exc_common ('%g' , '1' , TypeError ,
348- "a real number is required for format %g , not str" )
352+ "%g requires a real number, not str" )
349353 test_exc_common ('%g' , ('1' ,), TypeError ,
350- "format argument 1: a real number is required for format %g , not str" )
354+ "format argument 1: %g requires a real number, not str" )
351355
352356 def test_str_format (self ):
353357 testformat ("%r" , "\u0378 " , "'\\ u0378'" ) # non printable
@@ -386,11 +390,11 @@ def test_str_format(self):
386390 test_exc ('%(x).*r' , {'x' : 1 }, ValueError ,
387391 "* cannot be used with a parenthesised mapping key at position 0" )
388392 test_exc ('%(x)d' , {'x' : '1' }, TypeError ,
389- "format argument 'x': a real number is required for format %d , not str" )
393+ "format argument 'x': %d requires a real number, not str" )
390394 test_exc ('%(x)x' , {'x' : '1' }, TypeError ,
391- "format argument 'x': an integer is required for format %x , not str" )
395+ "format argument 'x': %x requires an integer , not str" )
392396 test_exc ('%(x)g' , {'x' : '1' }, TypeError ,
393- "format argument 'x': a real number is required for format %g , not str" )
397+ "format argument 'x': %g requires a real number, not str" )
394398 test_exc ('%c' , - 1 , OverflowError , "%c argument not in range(0x110000)" )
395399 test_exc ('%c' , (- 1 ,), OverflowError ,
396400 "format argument 1: %c argument not in range(0x110000)" )
@@ -466,7 +470,7 @@ def __bytes__(self):
466470 test_exc (b"abc %\n d" , 1 , ValueError ,
467471 "stray % at position 4 or unexpected format character with code 0x0a at position 5" )
468472 test_exc (b"abc %'d" , 1 , ValueError ,
469- "stray % at position 4 or unexpected format character with code 0x27 at position 5" )
473+ "stray % at position 4 or unexpected format character \" ' \" at position 5" )
470474 test_exc (b"abc %\x1f d" , 1 , ValueError ,
471475 "stray % at position 4 or unexpected format character with code 0x1f at position 5" )
472476 test_exc (b"abc %\x7f d" , 1 , ValueError ,
@@ -488,11 +492,11 @@ def __bytes__(self):
488492 test_exc (b'%(x).*r' , {b'x' : 1 }, ValueError ,
489493 "* cannot be used with a parenthesised mapping key at position 0" )
490494 test_exc (b'%(x)d' , {b'x' : '1' }, TypeError ,
491- "format argument b'x': a real number is required for format %d , not str" )
495+ "format argument b'x': %d requires a real number, not str" )
492496 test_exc (b'%(x)x' , {b'x' : '1' }, TypeError ,
493- "format argument b'x': an integer is required for format %x , not str" )
497+ "format argument b'x': %x requires an integer , not str" )
494498 test_exc (b'%(x)g' , {b'x' : '1' }, TypeError ,
495- "format argument b'x': a real number is required for format %g , not str" )
499+ "format argument b'x': %g requires a real number, not str" )
496500 test_exc (b"%c" , - 1 , OverflowError ,
497501 "%c argument not in range(256)" )
498502 test_exc (b"%c" , (- 1 ,), OverflowError ,
0 commit comments