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

Method test_writerows_with_none

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

Source from the content-addressed store, hash-verified

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:
305 writer = csv.writer(fileobj)
306 writer.writerows([['a', None], [None, 'd']])
307 fileobj.seek(0)
308 self.assertEqual(fileobj.read(), "a,\r\n,d\r\n")
309
310 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
311 writer = csv.writer(fileobj)
312 writer.writerows([[None], ['a']])
313 fileobj.seek(0)
314 self.assertEqual(fileobj.read(), '""\r\na\r\n')
315
316 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
317 writer = csv.writer(fileobj)
318 writer.writerows([['a'], [None]])
319 fileobj.seek(0)
320 self.assertEqual(fileobj.read(), 'a\r\n""\r\n')
321
322
323 @unittest.expectedFailure # TODO: RUSTPYTHON

Callers

nothing calls this directly

Calls 6

TemporaryFileFunction · 0.90
writerMethod · 0.45
writerowsMethod · 0.45
seekMethod · 0.45
assertEqualMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected