@@ -144,26 +144,16 @@ def testUnsetVarException(self):
144144
145145 def get_integers (self ):
146146 integers = (0 , 1 , - 1 , 2 ** 31 - 1 , - 2 ** 31 , 2 ** 31 , - 2 ** 31 - 1 , 2 ** 63 - 1 , - 2 ** 63 )
147- # bignum was added in Tcl 8.5, but its support is able only since 8.5.8.
148- # Actually it is determined at compile time, so using get_tk_patchlevel()
149- # is not reliable.
150- # TODO: expose full static version.
151- if tcl_version >= (8 , 5 ):
152- v = get_tk_patchlevel ()
153- if v >= (8 , 6 , 0 , 'final' ) or (8 , 5 , 8 ) <= v < (8 , 6 ):
154- integers += (2 ** 63 , - 2 ** 63 - 1 , 2 ** 1000 , - 2 ** 1000 )
147+ integers += (2 ** 63 , - 2 ** 63 - 1 , 2 ** 1000 , - 2 ** 1000 )
155148 return integers
156149
157150 def test_getint (self ):
158151 tcl = self .interp .tk
159152 for i in self .get_integers ():
160153 self .assertEqual (tcl .getint (' %d ' % i ), i )
161- if tcl_version >= (8 , 5 ):
162- self .assertEqual (tcl .getint (' %#o ' % i ), i )
154+ self .assertEqual (tcl .getint (' %#o ' % i ), i )
163155 self .assertEqual (tcl .getint ((' %#o ' % i ).replace ('o' , '' )), i )
164156 self .assertEqual (tcl .getint (' %#x ' % i ), i )
165- if tcl_version < (8 , 5 ): # bignum was added in Tcl 8.5
166- self .assertRaises (TclError , tcl .getint , str (2 ** 1000 ))
167157 self .assertEqual (tcl .getint (42 ), 42 )
168158 self .assertRaises (TypeError , tcl .getint )
169159 self .assertRaises (TypeError , tcl .getint , '42' , '10' )
@@ -317,8 +307,7 @@ def check(expr, expected):
317307 check ('"a\xbd \u20ac "' , 'a\xbd \u20ac ' )
318308 check (r'"a\xbd\u20ac"' , 'a\xbd \u20ac ' )
319309 check (r'"a\0b"' , 'a\x00 b' )
320- if tcl_version >= (8 , 5 ): # bignum was added in Tcl 8.5
321- check ('2**64' , str (2 ** 64 ))
310+ check ('2**64' , str (2 ** 64 ))
322311
323312 def test_exprdouble (self ):
324313 tcl = self .interp
@@ -349,8 +338,7 @@ def check(expr, expected):
349338 check ('[string length "a\xbd \u20ac "]' , 3.0 )
350339 check (r'[string length "a\xbd\u20ac"]' , 3.0 )
351340 self .assertRaises (TclError , tcl .exprdouble , '"abc"' )
352- if tcl_version >= (8 , 5 ): # bignum was added in Tcl 8.5
353- check ('2**64' , float (2 ** 64 ))
341+ check ('2**64' , float (2 ** 64 ))
354342
355343 def test_exprlong (self ):
356344 tcl = self .interp
@@ -381,8 +369,7 @@ def check(expr, expected):
381369 check ('[string length "a\xbd \u20ac "]' , 3 )
382370 check (r'[string length "a\xbd\u20ac"]' , 3 )
383371 self .assertRaises (TclError , tcl .exprlong , '"abc"' )
384- if tcl_version >= (8 , 5 ): # bignum was added in Tcl 8.5
385- self .assertRaises (TclError , tcl .exprlong , '2**64' )
372+ self .assertRaises (TclError , tcl .exprlong , '2**64' )
386373
387374 def test_exprboolean (self ):
388375 tcl = self .interp
@@ -422,10 +409,8 @@ def check(expr, expected):
422409 check ('[string length "a\xbd \u20ac "]' , True )
423410 check (r'[string length "a\xbd\u20ac"]' , True )
424411 self .assertRaises (TclError , tcl .exprboolean , '"abc"' )
425- if tcl_version >= (8 , 5 ): # bignum was added in Tcl 8.5
426- check ('2**64' , True )
412+ check ('2**64' , True )
427413
428- @unittest .skipUnless (tcl_version >= (8 , 5 ), 'requires Tcl version >= 8.5' )
429414 def test_booleans (self ):
430415 tcl = self .interp
431416 def check (expr , expected ):
@@ -455,8 +440,6 @@ def test_expr_bignum(self):
455440 else :
456441 self .assertEqual (result , str (i ))
457442 self .assertIsInstance (result , str )
458- if get_tk_patchlevel () < (8 , 5 ): # bignum was added in Tcl 8.5
459- self .assertRaises (TclError , tcl .call , 'expr' , str (2 ** 1000 ))
460443
461444 def test_passing_values (self ):
462445 def passValue (value ):
@@ -485,8 +468,6 @@ def passValue(value):
485468 b'str\xbd ing' if self .wantobjects else 'str\xbd ing' )
486469 for i in self .get_integers ():
487470 self .assertEqual (passValue (i ), i if self .wantobjects else str (i ))
488- if tcl_version < (8 , 5 ): # bignum was added in Tcl 8.5
489- self .assertEqual (passValue (2 ** 1000 ), str (2 ** 1000 ))
490471 for f in (0.0 , 1.0 , - 1.0 , 1 / 3 ,
491472 sys .float_info .min , sys .float_info .max ,
492473 - sys .float_info .min , - sys .float_info .max ):
@@ -552,8 +533,6 @@ def float_eq(actual, expected):
552533 check (b'str\xc0 \x80 ing\xe2 \x82 \xac ' , 'str\xc0 \x80 ing\xe2 \x82 \xac ' )
553534 for i in self .get_integers ():
554535 check (i , str (i ))
555- if tcl_version < (8 , 5 ): # bignum was added in Tcl 8.5
556- check (2 ** 1000 , str (2 ** 1000 ))
557536 for f in (0.0 , 1.0 , - 1.0 ):
558537 check (f , repr (f ))
559538 for f in (1 / 3.0 , sys .float_info .min , sys .float_info .max ,
@@ -600,16 +579,14 @@ def test_splitlist(self):
600579 ('1' , '2' , '3.4' )),
601580 ]
602581 tk_patchlevel = get_tk_patchlevel ()
603- if tcl_version >= (8 , 5 ):
604- if not self .wantobjects or tk_patchlevel < (8 , 5 , 5 ):
605- # Before 8.5.5 dicts were converted to lists through string
606- expected = ('12' , '\u20ac ' , '\xe2 \x82 \xac ' , '3.4' )
607- else :
608- expected = (12 , '\u20ac ' , b'\xe2 \x82 \xac ' , (3.4 ,))
609- testcases += [
610- (call ('dict' , 'create' , 12 , '\u20ac ' , b'\xe2 \x82 \xac ' , (3.4 ,)),
611- expected ),
612- ]
582+ if not self .wantobjects :
583+ expected = ('12' , '\u20ac ' , '\xe2 \x82 \xac ' , '3.4' )
584+ else :
585+ expected = (12 , '\u20ac ' , b'\xe2 \x82 \xac ' , (3.4 ,))
586+ testcases += [
587+ (call ('dict' , 'create' , 12 , '\u20ac ' , b'\xe2 \x82 \xac ' , (3.4 ,)),
588+ expected ),
589+ ]
613590 dbg_info = ('want objects? %s, Tcl version: %s, Tk patchlevel: %s'
614591 % (self .wantobjects , tcl_version , tk_patchlevel ))
615592 for arg , res in testcases :
@@ -642,15 +619,13 @@ def test_splitdict(self):
642619 {'a' : (1 , 2 , 3 ) if self .wantobjects else '1 2 3' ,
643620 'something' : 'foo' , 'status' : '' })
644621
645- if tcl_version >= (8 , 5 ):
646- arg = tcl .call ('dict' , 'create' ,
647- '-a' , (1 , 2 , 3 ), '-something' , 'foo' , 'status' , ())
648- if not self .wantobjects or get_tk_patchlevel () < (8 , 5 , 5 ):
649- # Before 8.5.5 dicts were converted to lists through string
650- expected = {'a' : '1 2 3' , 'something' : 'foo' , 'status' : '' }
651- else :
652- expected = {'a' : (1 , 2 , 3 ), 'something' : 'foo' , 'status' : '' }
653- self .assertEqual (splitdict (tcl , arg ), expected )
622+ arg = tcl .call ('dict' , 'create' ,
623+ '-a' , (1 , 2 , 3 ), '-something' , 'foo' , 'status' , ())
624+ if not self .wantobjects :
625+ expected = {'a' : '1 2 3' , 'something' : 'foo' , 'status' : '' }
626+ else :
627+ expected = {'a' : (1 , 2 , 3 ), 'something' : 'foo' , 'status' : '' }
628+ self .assertEqual (splitdict (tcl , arg ), expected )
654629
655630 def test_join (self ):
656631 join = tkinter ._join
0 commit comments