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

Method test_writerows

Lib/test/test_csv.py:289–301  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

287 self._write_test(iter([None, None]), ',')
288
289 def test_writerows(self):
290 class BrokenFile:
291 def write(self, buf):
292 raise OSError
293 writer = csv.writer(BrokenFile())
294 self.assertRaises(OSError, writer.writerows, [['a']])
295
296 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
297 writer = csv.writer(fileobj)
298 self.assertRaises(TypeError, writer.writerows, None)
299 writer.writerows([['a', 'b'], ['c', 'd']])
300 fileobj.seek(0)
301 self.assertEqual(fileobj.read(), "a,b\r\nc,d\r\n")
302
303 def test_writerows_with_none(self):
304 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:

Callers

nothing calls this directly

Calls 8

TemporaryFileFunction · 0.90
BrokenFileClass · 0.70
writerMethod · 0.45
assertRaisesMethod · 0.45
writerowsMethod · 0.45
seekMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected