File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed
Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 55import locale
66import operator
77import os
8+ import random
89import struct
910import subprocess
1011import sys
@@ -30,10 +31,6 @@ def requires_subinterpreters(meth):
3031 'subinterpreters required' )(meth )
3132
3233
33- # count the number of test runs, used to create unique
34- # strings to intern in test_intern()
35- INTERN_NUMRUNS = 0
36-
3734DICT_KEY_STRUCT_FORMAT = 'n2BI2n'
3835
3936class DisplayHookTest (unittest .TestCase ):
@@ -696,10 +693,8 @@ def test_43581(self):
696693 self .assertEqual (sys .__stdout__ .encoding , sys .__stderr__ .encoding )
697694
698695 def test_intern (self ):
699- global INTERN_NUMRUNS
700- INTERN_NUMRUNS += 1
701696 self .assertRaises (TypeError , sys .intern )
702- s = "never interned before" + str (INTERN_NUMRUNS )
697+ s = "never interned before" + str (random . randrange ( 0 , 10 ** 9 ) )
703698 self .assertTrue (sys .intern (s ) is s )
704699 s2 = s .swapcase ().swapcase ()
705700 self .assertTrue (sys .intern (s2 ) is s )
@@ -717,9 +712,7 @@ def __hash__(self):
717712
718713 @requires_subinterpreters
719714 def test_subinterp_intern_dynamically_allocated (self ):
720- global INTERN_NUMRUNS
721- INTERN_NUMRUNS += 1
722- s = "never interned before" + str (INTERN_NUMRUNS )
715+ s = "never interned before" + str (random .randrange (0 , 10 ** 9 ))
723716 t = sys .intern (s )
724717 self .assertIs (t , s )
725718
You can’t perform that action at this time.
0 commit comments