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

Method test_read_dict_fieldnames_chain

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

Source from the content-addressed store, hash-verified

995 self.assertEqual(next(reader), {"f1": '1', "f2": '2', "f3": 'abc'})
996
997 def test_read_dict_fieldnames_chain(self):
998 import itertools
999 with TemporaryFile("w+", encoding="utf-8") as fileobj:
1000 fileobj.write("f1,f2,f3\r\n1,2,abc\r\n")
1001 fileobj.seek(0)
1002 reader = csv.DictReader(fileobj)
1003 first = next(reader)
1004 for row in itertools.chain([first], reader):
1005 self.assertEqual(reader.fieldnames, ["f1", "f2", "f3"])
1006 self.assertEqual(row, {"f1": '1', "f2": '2', "f3": 'abc'})
1007
1008 def test_read_long(self):
1009 with TemporaryFile("w+", encoding="utf-8") as fileobj:

Callers

nothing calls this directly

Calls 6

TemporaryFileFunction · 0.90
nextFunction · 0.85
chainMethod · 0.80
writeMethod · 0.45
seekMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected