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

Method test_write_simple_dict

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

Source from the content-addressed store, hash-verified

868 self.assertEqual(writeheader_return_value, 10)
869
870 def test_write_simple_dict(self):
871 with TemporaryFile("w+", encoding="utf-8", newline='') as fileobj:
872 writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"])
873 writer.writeheader()
874 fileobj.seek(0)
875 self.assertEqual(fileobj.readline(), "f1,f2,f3\r\n")
876 writer.writerow({"f1": 10, "f3": "abc"})
877 fileobj.seek(0)
878 fileobj.readline() # header
879 self.assertEqual(fileobj.read(), "10,,abc\r\n")
880
881 def test_write_multiple_dict_rows(self):
882 fileobj = StringIO()

Callers

nothing calls this directly

Calls 7

writeheaderMethod · 0.95
writerowMethod · 0.95
TemporaryFileFunction · 0.90
seekMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected