Adding upstream version 2.1.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d1aeef90c9
commit
d8a70e48ab
56 changed files with 3865 additions and 0 deletions
33
tests/tabular_output/test_tsv_output_adapter.py
Normal file
33
tests/tabular_output/test_tsv_output_adapter.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Test the tsv delimited output adapter."""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
|
||||
from cli_helpers.tabular_output import tsv_output_adapter
|
||||
|
||||
|
||||
def test_tsv_wrapper():
|
||||
"""Test the tsv output adapter."""
|
||||
# Test tab-delimited output.
|
||||
data = [['ab\r\nc', '1'], ['d', '456']]
|
||||
headers = ['letters', 'number']
|
||||
output = tsv_output_adapter.adapter(
|
||||
iter(data), headers, table_format='tsv')
|
||||
assert "\n".join(output) == dedent('''\
|
||||
letters\tnumber\n\
|
||||
ab\r\\nc\t1\n\
|
||||
d\t456''')
|
||||
|
||||
|
||||
def test_unicode_with_tsv():
|
||||
"""Test that the tsv wrapper can handle non-ascii characters."""
|
||||
data = [['观音', '1'], ['Ποσειδῶν', '456']]
|
||||
headers = ['letters', 'number']
|
||||
output = tsv_output_adapter.adapter(data, headers)
|
||||
assert "\n".join(output) == dedent('''\
|
||||
letters\tnumber\n\
|
||||
观音\t1\n\
|
||||
Ποσειδῶν\t456''')
|
Loading…
Add table
Add a link
Reference in a new issue