Kaydet (Commit) 23016276 authored tarafından Georg Brandl's avatar Georg Brandl

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.
........
üst a8507d59
...@@ -13,6 +13,7 @@ warnings.filterwarnings("ignore", "integer argument expected", ...@@ -13,6 +13,7 @@ warnings.filterwarnings("ignore", "integer argument expected",
# count the number of test runs. # count the number of test runs.
# used to skip running test_execfile() multiple times # used to skip running test_execfile() multiple times
# and to create unique strings to intern in test_intern()
numruns = 0 numruns = 0
class Squares: class Squares:
...@@ -646,7 +647,9 @@ class BuiltinTest(unittest.TestCase): ...@@ -646,7 +647,9 @@ class BuiltinTest(unittest.TestCase):
def test_intern(self): def test_intern(self):
self.assertRaises(TypeError, intern) self.assertRaises(TypeError, intern)
s = "never interned before" # This fails if the test is run twice with a constant string,
# therefore append the run counter
s = "never interned before " + str(numruns)
self.assert_(intern(s) is s) self.assert_(intern(s) is s)
s2 = s.swapcase().swapcase() s2 = s.swapcase().swapcase()
self.assert_(intern(s2) is s) self.assert_(intern(s2) is s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment