@@ -307,28 +307,19 @@ def sumtest(values, expected):
307307 sumtest ([1.7976931348623157e+308 , long (1.7976931348623157e+308 )], inf )
308308 self .assertRaises (OverflowError , sum , [1.0 , 100000000 << 2000 ])
309309
310- def test_unichr (self ):
311-
312- #Added the following to resolve Codeplex WorkItem #3220.
313- max_uni = sys .maxunicode
314- self .assertTrue (max_uni == 0xFFFF or max_uni == 0x10FFFF )
315- max_uni_plus_one = max_uni + 1
316-
317- huger_than_max = 100000
318- max_ok_value = u'\uffff '
319-
320- #special case for WorkItem #3220
321- if max_uni == 0x10FFFF :
322- huger_than_max = 10000000
323- max_ok_value = u'\U0010FFFF '
324-
325- unichr = chr
326-
327- self .assertRaises (ValueError , unichr , - 1 ) # arg must be in the range [0...65535] or [0...1114111] inclusive
328- self .assertRaises (ValueError , unichr , max_uni_plus_one )
329- self .assertRaises (ValueError , unichr , huger_than_max )
330- self .assertTrue (unichr (0 ) == '\x00 ' )
331- self .assertTrue (unichr (max_uni ) == max_ok_value )
310+ def test_chr (self ):
311+ self .assertEqual (sys .maxunicode , 0xFFFF if is_cli else 0x10FFFF )
312+
313+ max_chr = 0x10FFFF
314+ max_chr_plus_one = max_chr + 1
315+ overflow_chr = 1 << 64
316+
317+ # chr() arg must be in range(0x110000)
318+ self .assertRaises (ValueError , chr , - 1 )
319+ self .assertRaises (ValueError , chr , max_chr_plus_one )
320+ self .assertRaises (OverflowError , chr , overflow_chr )
321+ self .assertTrue (chr (0 ) == '\x00 ' )
322+ self .assertTrue (chr (max_chr ) == u'\U0010FFFF ' )
332323
333324 def test_max (self ):
334325 self .assertEqual (max ('123123' ), '3' )
0 commit comments