MCPcopy Create free account
hub / github.com/Pylons/webtest / test_close

Method test_close

tests/test_lint.py:244–265  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

242
243class TestIteratorWrapper(unittest.TestCase):
244 def test_close(self):
245 class MockIterator:
246
247 def __init__(self):
248 self.closed = False
249
250 def __iter__(self):
251 return self
252
253 def __next__(self):
254 return None
255
256 next = __next__
257
258 def close(self):
259 self.closed = True
260
261 mock = MockIterator()
262 wrapper = IteratorWrapper(mock, None)
263 wrapper.close()
264
265 self.assertTrue(mock.closed, "Original iterator has not been closed")
266
267
268class TestWriteWrapper(unittest.TestCase):

Callers

nothing calls this directly

Calls 3

closeMethod · 0.95
IteratorWrapperClass · 0.90
MockIteratorClass · 0.85

Tested by

no test coverage detected