MCPcopy Create free account
hub / github.com/python/cpython / test_consume_iterator_twice

Method test_consume_iterator_twice

Lib/test/test_os/test_os.py:5069–5078  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5067 self.assertRaises(FileNotFoundError, os.scandir, '')
5068
5069 def test_consume_iterator_twice(self):
5070 self.create_file("file.txt")
5071 iterator = os.scandir(self.path)
5072
5073 entries = list(iterator)
5074 self.assertEqual(len(entries), 1, entries)
5075
5076 # check than consuming the iterator twice doesn't raise exception
5077 entries2 = list(iterator)
5078 self.assertEqual(len(entries2), 0, entries2)
5079
5080 def test_bad_path_type(self):
5081 for obj in [1.234, {}, []]:

Callers

nothing calls this directly

Calls 4

create_fileMethod · 0.95
listClass · 0.85
scandirMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected