From 4c3d4895331f6fa4ec068126bab00c5b2ffff47d Mon Sep 17 00:00:00 2001 From: Bob Whitelock Date: Sat, 27 May 2017 20:02:53 +0100 Subject: [PATCH] Switch to using unicode table So output displays correctly in less; previously the tables were messing up all the output. Refer to: https://github.com/Robpol86/terminaltables/pull/42. --- requirements.txt | 2 +- src/doc_parser.py | 2 +- src/test_doc_parser.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 7e3ab8e..e96b1c9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,6 +16,6 @@ pytest-mock==1.6.0 python-Levenshtein==0.12.0 simplegeneric==0.8.1 six==1.10.0 -terminaltables==3.1.0 +-e git+https://github.com/BobWhitelock/terminaltables.git@2374ae57b8819adc57be5644799fc61cc8e2bf65#egg=terminaltables traitlets==4.3.2 wcwidth==0.1.7 diff --git a/src/doc_parser.py b/src/doc_parser.py index dcae00b..7f20460 100644 --- a/src/doc_parser.py +++ b/src/doc_parser.py @@ -131,7 +131,7 @@ def parse_table(element): row_content = parse_table_row(row) table_data.append(row_content) - table = terminaltables.SingleTable(table_data).table + table = terminaltables.UnicodeSingleTable(table_data).table return table diff --git a/src/test_doc_parser.py b/src/test_doc_parser.py index 69c1892..0c626dd 100644 --- a/src/test_doc_parser.py +++ b/src/test_doc_parser.py @@ -108,7 +108,7 @@ def test_parsing_nested_elements(): def test_parsing_table(mocker): - mocker.spy(terminaltables, 'SingleTable') + mocker.spy(terminaltables, 'UnicodeSingleTable') # Wrapper div included to ensure table parsed at any level. html = ( @@ -130,12 +130,12 @@ def test_parsing_table(mocker): # Test table created with correct data (more easily debuggable than # `parse_test`). - assert terminaltables.SingleTable.call_args_list == [ + assert terminaltables.UnicodeSingleTable.call_args_list == [ mock.call(expected_table_data) ] # Ensure correct table generated. - expected_terminal_table = terminaltables.SingleTable( + expected_terminal_table = terminaltables.UnicodeSingleTable( expected_table_data ).table parse_test(html, expected_terminal_table)