MCPcopy Index your code
hub / github.com/python/cpython / test_writerows

Method test_writerows

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected