Skip to content

Commit

Permalink
merge heads
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Apr 29, 2014
2 parents 8af740c + 05da1ef commit 7971286
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Lib/test/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,16 @@ def test_write_simple_dict(self):
fileobj.readline() # header
self.assertEqual(fileobj.read(), "10,,abc\r\n")

def test_write_multiple_dict_rows(self):
fileobj = StringIO()
writer = csv.DictWriter(fileobj, fieldnames=["f1", "f2", "f3"])
writer.writeheader()
self.assertEqual(fileobj.getvalue(), "f1,f2,f3\r\n")
writer.writerows([{"f1": 1, "f2": "abc", "f3": "f"},
{"f1": 2, "f2": 5, "f3": "xyz"}])
self.assertEqual(fileobj.getvalue(),
"f1,f2,f3\r\n1,abc,f\r\n2,5,xyz\r\n")

def test_write_no_fields(self):
fileobj = StringIO()
self.assertRaises(TypeError, csv.DictWriter, fileobj)
Expand Down
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ Juhana Jauhiainen
Rajagopalasarma Jayakrishnan
Zbigniew Jędrzejewski-Szmek
Julien Jehannet
Muhammad Jehanzeb
Drew Jenkins
Flemming Kjær Jensen
Philip H. Jensen
Expand Down

0 comments on commit 7971286

Please sign in to comment.