Fix problem with csv writer writing every field on own line, if not header information.
Update tests to accommodate change.
This commit is contained in:
@ -126,8 +126,7 @@ class CsvWriter(FileWriter, CsvHandler):
|
||||
)
|
||||
context.writer(values)
|
||||
else:
|
||||
for arg in values:
|
||||
context.writer(ensure_tuple(arg))
|
||||
context.writer(ensure_tuple(values))
|
||||
|
||||
return NOT_MODIFIED
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ class CsvWriterTest(Csv, WriterTest, TestCase):
|
||||
@incontext()
|
||||
def test_nofields_multiple_args(self, context):
|
||||
# multiple args are iterated onto and flattened in output
|
||||
context.write_sync((L1, L2), (L3, L4))
|
||||
context.write_sync(L1, L2, L3, L4)
|
||||
context.stop()
|
||||
|
||||
assert self.readlines() == ("a,hey", "b,bee", "c,see", "d,dee")
|
||||
@ -111,18 +111,10 @@ class CsvWriterTest(Csv, WriterTest, TestCase):
|
||||
with pytest.raises(TypeError):
|
||||
context.write_sync((L1, L2), (L3,))
|
||||
|
||||
@incontext()
|
||||
def test_nofields_single_arg(self, context):
|
||||
# single args are just dumped, shapes can vary.
|
||||
context.write_sync((L1,), (LL,), (L3,))
|
||||
context.stop()
|
||||
|
||||
assert self.readlines() == ("a,hey", "i,have,more,values", "c,see")
|
||||
|
||||
@incontext()
|
||||
def test_nofields_empty_args(self, context):
|
||||
# empty calls are ignored
|
||||
context.write_sync(EMPTY, EMPTY, EMPTY)
|
||||
context.stop()
|
||||
|
||||
assert self.readlines() == ()
|
||||
assert self.readlines() == ('', '', '')
|
||||
|
||||
Reference in New Issue
Block a user