# 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:
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)