Allows to provide False fields to CsvWriter, or to override field headers using the fields= option.

This commit is contained in:
Romain Dorgueil
2018-10-27 15:29:19 +02:00
parent a140e6506e
commit 5499c548b0
3 changed files with 22 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import pytest
from bonobo.util import ensure_tuple, sortedlist
from bonobo.util.collections import cast, tuplize
from bonobo.util.collections import cast, tuplize, tuple_or_const
def test_sortedlist():
@ -13,6 +13,13 @@ def test_sortedlist():
assert l == [1, 2, 2, 3]
def test_tuple_or_const():
assert tuple_or_const(()) == ()
assert tuple_or_const((1, )) == (1, )
assert tuple_or_const((1, 2, )) == (1, 2, )
assert tuple_or_const([1, 2, ]) == (1, 2, )
assert tuple_or_const("aaa") == ('aaa', )
def test_ensure_tuple():
assert ensure_tuple("a") == ("a",)
assert ensure_tuple(("a",)) == ("a",)