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

Method test_write_multiple_dict_rows

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

Source from the content-addressed store, hash-verified

879 self.assertEqual(fileobj.read(), "10,,abc\r\n")
880
881 def test_write_multiple_dict_rows(self):
882 fileobj = StringIO()
883 writer = csv.DictWriter(fileobj, fieldnames=["f1", "f2", "f3"])
884 writer.writeheader()
885 self.assertEqual(fileobj.getvalue(), "f1,f2,f3\r\n")
886 writer.writerows([{"f1": 1, "f2": "abc", "f3": "f"},
887 {"f1": 2, "f2": 5, "f3": "xyz"}])
888 self.assertEqual(fileobj.getvalue(),
889 "f1,f2,f3\r\n1,abc,f\r\n2,5,xyz\r\n")
890
891 def test_write_no_fields(self):
892 fileobj = StringIO()

Callers

nothing calls this directly

Calls 5

writeheaderMethod · 0.95
getvalueMethod · 0.95
writerowsMethod · 0.95
StringIOClass · 0.90
assertEqualMethod · 0.45

Tested by

no test coverage detected