Improve test coverage. Hope the test_file changes work the same on windows.

This commit is contained in:
Neal Norwitz 2005-11-27 20:37:43 +00:00
parent 307021f40b
commit fcf4435ae0
5 changed files with 75 additions and 0 deletions

View file

@ -606,6 +606,8 @@ class TestBasicOps(unittest.TestCase):
def test_iteration(self):
for v in self.set:
self.assert_(v in self.values)
setiter = iter(self.set)
self.assertEqual(setiter._length_cue(), len(self.set))
def test_pickling(self):
p = pickle.dumps(self.set)
@ -693,6 +695,16 @@ class TestExceptionPropagation(unittest.TestCase):
set('abc')
set(gooditer())
def test_changingSizeWhileIterating(self):
s = set([1,2,3])
try:
for i in s:
s.update([4])
except RuntimeError:
pass
else:
self.fail("no exception when changing size during iteration")
#==============================================================================
class TestSetOfSets(unittest.TestCase):