Merged revisions 75887 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r75887 | georg.brandl | 2009-10-27 23:56:09 +0100 (Di, 27 Okt 2009) | 1 line

  Make sure every run of test_intern() interns a new string, otherwise that test fails e.g. when some other test in test_builtin fails and it is rerun in verbose mode.
........
This commit is contained in:
Georg Brandl 2009-10-27 23:00:28 +00:00
parent a9023be873
commit 035265540a
1 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,11 @@ import struct
import subprocess
import textwrap
# count the number of test runs, used to create unique
# strings to intern in test_intern()
numruns = 0
class SysModuleTest(unittest.TestCase):
def setUp(self):
@ -383,8 +388,10 @@ class SysModuleTest(unittest.TestCase):
self.assertEqual(sys.__stdout__.encoding, sys.__stderr__.encoding)
def test_intern(self):
global numruns
numruns += 1
self.assertRaises(TypeError, sys.intern)
s = "never interned before"
s = "never interned before" + str(numruns)
self.assertTrue(sys.intern(s) is s)
s2 = s.swapcase().swapcase()
self.assertTrue(sys.intern(s2) is s)