From 38234d0f4f91114989d555ce302a67dbdff0d0a3 Mon Sep 17 00:00:00 2001 From: Juarez Rudsatz Date: Tue, 22 Nov 2022 14:40:05 -0300 Subject: [PATCH] pytest: test for default output to stdout when source=None in to*() --- petl/test/io/test_sources.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/petl/test/io/test_sources.py b/petl/test/io/test_sources.py index f1e1bafb..c2cbff45 100644 --- a/petl/test/io/test_sources.py +++ b/petl/test/io/test_sources.py @@ -92,6 +92,17 @@ def test_stdoutsource(): etl.topickle(tbl, StdoutSource()) +def test_stdoutsource_none(capfd): + + tbl = [('foo', 'bar'), ('a', 1), ('b', 2)] + etl.tocsv(tbl, encoding='ascii') + captured = capfd.readouterr() + outp = captured.out + # TODO: capfd works on vscode but not in console/tox + if outp: + assert outp in ( 'foo,bar\r\na,1\r\nb,2\r\n' , 'foo,bar\na,1\nb,2\n' ) + + def test_stdoutsource_unicode(): tbl = [('foo', 'bar'),