diff options
author | Georg Brandl <georg@python.org> | 2009-10-27 22:56:09 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-10-27 22:56:09 (GMT) |
commit | 4e1be94bc6c7ec21daf1de030cc59c9c61b498f8 (patch) | |
tree | e784c00e70d64bb4a960c4e129cc9a166845ab5b /Lib | |
parent | 53e9fa4eed281dc7d1dc05ba359ee2d546a7500f (diff) | |
download | cpython-4e1be94bc6c7ec21daf1de030cc59c9c61b498f8.zip cpython-4e1be94bc6c7ec21daf1de030cc59c9c61b498f8.tar.gz cpython-4e1be94bc6c7ec21daf1de030cc59c9c61b498f8.tar.bz2 |
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.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_builtin.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index 3cd5bd9..62dca5bd 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -13,6 +13,7 @@ warnings.filterwarnings("ignore", "integer argument expected", # count the number of test runs. # used to skip running test_execfile() multiple times +# and to create unique strings to intern in test_intern() numruns = 0 class Squares: @@ -646,7 +647,9 @@ class BuiltinTest(unittest.TestCase): def test_intern(self): 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.assertTrue(intern(s) is s) s2 = s.swapcase().swapcase() self.assertTrue(intern(s2) is s) |