MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_consume_iterator_twice

Method test_consume_iterator_twice

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

Source from the content-addressed store, hash-verified

5343 self.assertRaises(FileNotFoundError, os.scandir, '')
5344
5345 def test_consume_iterator_twice(self):
5346 self.create_file("file.txt")
5347 iterator = os.scandir(self.path)
5348
5349 entries = list(iterator)
5350 self.assertEqual(len(entries), 1, entries)
5351
5352 # check than consuming the iterator twice doesn't raise exception
5353 entries2 = list(iterator)
5354 self.assertEqual(len(entries2), 0, entries2)
5355
5356 def test_bad_path_type(self):
5357 for obj in [1.234, {}, []]:

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected