Hello community, here is the log from the commit of package python-cli-helpers for openSUSE:Factory checked in at 2020-06-24 15:49:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cli-helpers (Old) and /work/SRC/openSUSE:Factory/.python-cli-helpers.new.2956 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cli-helpers" Wed Jun 24 15:49:22 2020 rev:5 rq:816741 version:2.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cli-helpers/python-cli-helpers.changes 2020-04-23 18:38:21.064996087 +0200 +++ /work/SRC/openSUSE:Factory/.python-cli-helpers.new.2956/python-cli-helpers.changes 2020-06-24 15:49:27.096547222 +0200 @@ -1,0 +2,9 @@ +Wed Jun 24 02:11:31 UTC 2020 - Steve Kowalik <[email protected]> + +- Update to 2.0.1: + * Fix newline escaping in plain-text formatters (ascii, double, github) + * Use built-in unittest.mock instead of mock. + * Remove Python 2.7 and 3.5. + * Style config for missing value. + +------------------------------------------------------------------- Old: ---- cli_helpers-1.2.1.tar.gz New: ---- cli_helpers-2.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cli-helpers.spec ++++++ --- /var/tmp/diff_new_pack.d5Gfux/_old 2020-06-24 15:49:28.104551448 +0200 +++ /var/tmp/diff_new_pack.d5Gfux/_new 2020-06-24 15:49:28.108551465 +0200 @@ -19,11 +19,10 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-cli-helpers -Version: 1.2.1 +Version: 2.0.1 Release: 0 Summary: Helpers for building command-line apps License: BSD-3-Clause -Group: Development/Languages/Python URL: https://github.com/dbcli/cli_helpers Source: https://files.pythonhosted.org/packages/source/c/cli_helpers/cli_helpers-%{version}.tar.gz BuildRequires: %{python_module setuptools} ++++++ cli_helpers-1.2.1.tar.gz -> cli_helpers-2.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/AUTHORS new/cli_helpers-2.0.1/AUTHORS --- old/cli_helpers-1.2.1/AUTHORS 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/AUTHORS 2020-05-28 00:09:35.000000000 +0200 @@ -17,7 +17,10 @@ - Terje Røsten - Frederic Aoustin - Zhaolong Zhu - +- Karthikeyan Singaravelan +- laixintao +- Georgy Frolov +- Michał Górny Thanks ------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/CHANGELOG new/cli_helpers-2.0.1/CHANGELOG --- old/cli_helpers-1.2.1/CHANGELOG 2019-06-10 13:30:21.000000000 +0200 +++ new/cli_helpers-2.0.1/CHANGELOG 2020-05-28 00:44:39.000000000 +0200 @@ -1,6 +1,22 @@ Changelog ========= +Version 2.0.1 +------------- + +(released on 2020-05-27) + +* Fix newline escaping in plain-text formatters (ascii, double, github) +* Use built-in unittest.mock instead of mock. + +Version 2.0.0 +------------- + +(released on 2020-05-26) + +* Remove Python 2.7 and 3.5. +* Style config for missing value. + Version 1.2.1 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/CONTRIBUTING.rst new/cli_helpers-2.0.1/CONTRIBUTING.rst --- old/cli_helpers-1.2.1/CONTRIBUTING.rst 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/CONTRIBUTING.rst 2020-03-11 18:20:19.000000000 +0100 @@ -63,7 +63,7 @@ $ pytest -CLI Helpers supports Python 2.7 and 3.4+. You can test against multiple versions of +CLI Helpers supports Python 3.6+. You can test against multiple versions of Python by running:: $ tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/PKG-INFO new/cli_helpers-2.0.1/PKG-INFO --- old/cli_helpers-1.2.1/PKG-INFO 2019-06-10 13:33:31.000000000 +0200 +++ new/cli_helpers-2.0.1/PKG-INFO 2020-05-28 00:44:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: cli_helpers -Version: 1.2.1 +Version: 2.0.1 Summary: Helpers for building command-line apps Home-page: https://github.com/dbcli/cli_helpers Author: dbcli @@ -50,9 +50,7 @@ Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: Unix Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Software Development diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/__init__.py new/cli_helpers-2.0.1/cli_helpers/__init__.py --- old/cli_helpers-1.2.1/cli_helpers/__init__.py 2019-06-10 13:30:21.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/__init__.py 2020-05-28 00:44:42.000000000 +0200 @@ -1 +1 @@ -__version__ = '1.2.1' +__version__ = '2.0.1' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/config.py new/cli_helpers-2.0.1/cli_helpers/config.py --- old/cli_helpers-1.2.1/cli_helpers/config.py 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/config.py 2020-05-26 23:23:40.000000000 +0200 @@ -204,9 +204,9 @@ Unix: ``~/.config/my-app`` Windows 7 (roaming): - ``C:\\Users\<user>\AppData\Roaming\Acme\My App`` + ``C:\\Users\\<user>\\AppData\\Roaming\\Acme\\My App`` Windows 7 (not roaming): - ``C:\\Users\<user>\AppData\Local\Acme\My App`` + ``C:\\Users\\<user>\\AppData\\Local\\Acme\\My App`` :param app_name: the application name. This should be properly capitalized and can contain whitespace. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/tabular_output/output_formatter.py new/cli_helpers-2.0.1/cli_helpers/tabular_output/output_formatter.py --- old/cli_helpers-1.2.1/cli_helpers/tabular_output/output_formatter.py 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/tabular_output/output_formatter.py 2020-05-26 23:23:40.000000000 +0200 @@ -121,7 +121,7 @@ def format_output(self, data, headers, format_name=None, preprocessors=(), column_types=None, **kwargs): - """Format the headers and data using a specific formatter. + r"""Format the headers and data using a specific formatter. *format_name* must be a supported formatter (see :attr:`supported_formats`). @@ -179,7 +179,7 @@ def format_output(data, headers, format_name, **kwargs): - """Format output using *format_name*. + r"""Format output using *format_name*. This is a wrapper around the :class:`TabularOutputFormatter` class. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/tabular_output/preprocessors.py new/cli_helpers-2.0.1/cli_helpers/tabular_output/preprocessors.py --- old/cli_helpers-1.2.1/cli_helpers/tabular_output/preprocessors.py 2019-06-09 13:52:10.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/tabular_output/preprocessors.py 2020-05-28 00:09:35.000000000 +0200 @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- """These preprocessor functions are used to process data prior to output.""" +import re import string from cli_helpers import utils -from cli_helpers.compat import (text_type, int_types, float_types, - HAS_PYGMENTS, Terminal256Formatter, StringIO) +from cli_helpers.compat import text_type, int_types, float_types, HAS_PYGMENTS def truncate_string(data, headers, max_field_width=None, skip_multiline_string=True, **_): @@ -40,20 +40,36 @@ [utils.to_string(h) for h in headers]) -def override_missing_value(data, headers, missing_value='', **_): +def override_missing_value(data, headers, style=None, + missing_value_token="Token.Output.Null", + missing_value='', **_): """Override missing values in the *data* with *missing_value*. A missing value is any value that is :data:`None`. :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. + :param style: Style for missing_value. + :param missing_value_token: The Pygments token used for missing data. :param missing_value: The default value to use for missing data. :return: The processed data and headers. :rtype: tuple """ - return (([missing_value if v is None else v for v in row] for row in data), - headers) + def fields(): + for row in data: + processed = [] + for field in row: + if field is None and style and HAS_PYGMENTS: + styled = utils.style_field(missing_value_token, missing_value, style) + processed.append(styled) + elif field is None: + processed.append(missing_value) + else: + processed.append(field) + yield processed + + return (fields(), headers) def override_tab_value(data, headers, new_value=' ', **_): @@ -71,6 +87,29 @@ headers) +def escape_newlines(data, headers, **_): + """Escape newline characters (\n -> \\n, \r -> \\r) + + :param iterable data: An :term:`iterable` (e.g. list) of rows. + :param iterable headers: The column headers. + :return: The processed data and headers. + :rtype: tuple + + """ + return ( + ( + [ + v.replace("\r", r"\r").replace("\n", r"\n") + if isinstance(v, text_type) + else v + for v in row + ] + for row in data + ), + headers, + ) + + def bytes_to_string(data, headers, **_): """Convert all *data* and *headers* bytes to strings. @@ -206,7 +245,7 @@ :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. :param str/pygments.style.Style style: A Pygments style. You can `create - your own styles <http://pygments.org/docs/styles/#creating-own-styles>`_. + your own styles <https://pygments.org/docs/styles#creating-own-styles>`_. :param str header_token: The token type to be used for the headers. :param str odd_row_token: The token type to be used for odd rows. :param str even_row_token: The token type to be used for even rows. @@ -215,16 +254,8 @@ """ if style and HAS_PYGMENTS: - formatter = Terminal256Formatter(style=style) - - def style_field(token, field): - """Get the styled text for a *field* using *token* type.""" - s = StringIO() - formatter.format(((token, field),), s) - return s.getvalue() - - headers = [style_field(header_token, header) for header in headers] - data = ([style_field(odd_row_token if i % 2 else even_row_token, f) + headers = [utils.style_field(header_token, header, style) for header in headers] + data = ([utils.style_field(odd_row_token if i % 2 else even_row_token, f, style) for f in r] for i, r in enumerate(data, 1)) return iter(data), headers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/tabular_output/tabulate_adapter.py new/cli_helpers-2.0.1/cli_helpers/tabular_output/tabulate_adapter.py --- old/cli_helpers-1.2.1/cli_helpers/tabular_output/tabulate_adapter.py 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/tabular_output/tabulate_adapter.py 2020-05-26 23:23:40.000000000 +0200 @@ -4,8 +4,9 @@ from __future__ import unicode_literals from cli_helpers.utils import filter_dict_by_key +from cli_helpers.compat import (Terminal256Formatter, StringIO) from .preprocessors import (convert_to_string, truncate_string, override_missing_value, - style_output, HAS_PYGMENTS, Terminal256Formatter, StringIO) + style_output, HAS_PYGMENTS) import tabulate @@ -51,7 +52,7 @@ :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. :param str/pygments.style.Style style: A Pygments style. You can `create - your own styles <http://pygments.org/docs/styles/#creating-own-styles>`_. + your own styles <https://pygments.org/docs/styles#creating-own-styles>`_. :param str table_separator_token: The token type to be used for the table separator. :return: data and headers. :rtype: tuple diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/tabular_output/terminaltables_adapter.py new/cli_helpers-2.0.1/cli_helpers/tabular_output/terminaltables_adapter.py --- old/cli_helpers-1.2.1/cli_helpers/tabular_output/terminaltables_adapter.py 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/tabular_output/terminaltables_adapter.py 2020-05-28 00:09:35.000000000 +0200 @@ -7,14 +7,15 @@ import itertools from cli_helpers.utils import filter_dict_by_key +from cli_helpers.compat import (Terminal256Formatter, StringIO) from .preprocessors import (convert_to_string, truncate_string, override_missing_value, - style_output, HAS_PYGMENTS, Terminal256Formatter, StringIO, - override_tab_value) + style_output, HAS_PYGMENTS, + override_tab_value, escape_newlines) supported_formats = ('ascii', 'double', 'github') preprocessors = ( override_missing_value, convert_to_string, override_tab_value, - truncate_string, style_output + truncate_string, style_output, escape_newlines ) table_format_handler = { @@ -56,7 +57,7 @@ :param iterable data: An :term:`iterable` (e.g. list) of rows. :param iterable headers: The column headers. :param str/pygments.style.Style style: A Pygments style. You can `create - your own styles <http://pygments.org/docs/styles/#creating-own-styles>`_. + your own styles <https://pygments.org/docs/styles#creating-own-styles>`_. :param str table_separator_token: The token type to be used for the table separator. :return: data and headers. :rtype: tuple diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers/utils.py new/cli_helpers-2.0.1/cli_helpers/utils.py --- old/cli_helpers-1.2.1/cli_helpers/utils.py 2019-06-09 13:52:10.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers/utils.py 2020-05-26 23:23:40.000000000 +0200 @@ -4,7 +4,7 @@ import binascii import re -from cli_helpers.compat import binary_type, text_type +from cli_helpers.compat import binary_type, text_type, Terminal256Formatter, StringIO def bytes_to_string(b): @@ -55,7 +55,7 @@ return [x for x in seq if not (x in seen or seen.add(x))] -_ansi_re = re.compile('\033\[((?:\d|;)*)([a-zA-Z])') +_ansi_re = re.compile('\033\\[((?:\\d|;)*)([a-zA-Z])') def strip_ansi(value): @@ -68,3 +68,11 @@ for r in replace: s = s.replace(*r) return s + + +def style_field(token, field, style): + """Get the styled text for a *field* using *token* type.""" + formatter = Terminal256Formatter(style=style) + s = StringIO() + formatter.format(((token, field),), s) + return s.getvalue() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers.egg-info/PKG-INFO new/cli_helpers-2.0.1/cli_helpers.egg-info/PKG-INFO --- old/cli_helpers-1.2.1/cli_helpers.egg-info/PKG-INFO 2019-06-10 13:33:30.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers.egg-info/PKG-INFO 2020-05-28 00:44:59.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: cli-helpers -Version: 1.2.1 +Version: 2.0.1 Summary: Helpers for building command-line apps Home-page: https://github.com/dbcli/cli_helpers Author: dbcli @@ -50,9 +50,7 @@ Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: Unix Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Topic :: Software Development diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/cli_helpers.egg-info/SOURCES.txt new/cli_helpers-2.0.1/cli_helpers.egg-info/SOURCES.txt --- old/cli_helpers-1.2.1/cli_helpers.egg-info/SOURCES.txt 2019-06-10 13:33:30.000000000 +0200 +++ new/cli_helpers-2.0.1/cli_helpers.egg-info/SOURCES.txt 2020-05-28 00:44:59.000000000 +0200 @@ -4,6 +4,7 @@ LICENSE MANIFEST.in README.rst +release.py requirements-dev.txt setup.cfg setup.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/release.py new/cli_helpers-2.0.1/release.py --- old/cli_helpers-1.2.1/release.py 1970-01-01 01:00:00.000000000 +0100 +++ new/cli_helpers-2.0.1/release.py 2020-05-26 23:58:52.000000000 +0200 @@ -0,0 +1,135 @@ +#!/usr/bin/env python +"""A script to publish a release of cli_helpers to PyPI.""" + +import io +from optparse import OptionParser +import re +import subprocess +import sys + +import click + +DEBUG = False +CONFIRM_STEPS = False +DRY_RUN = False + + +def skip_step(): + """ + Asks for user's response whether to run a step. Default is yes. + :return: boolean + """ + global CONFIRM_STEPS + + if CONFIRM_STEPS: + return not click.confirm("--- Run this step?", default=True) + return False + + +def run_step(*args): + """ + Prints out the command and asks if it should be run. + If yes (default), runs it. + :param args: list of strings (command and args) + """ + global DRY_RUN + + cmd = args + print(" ".join(cmd)) + if skip_step(): + print("--- Skipping...") + elif DRY_RUN: + print("--- Pretending to run...") + else: + subprocess.check_output(cmd) + + +def version(version_file): + _version_re = re.compile( + r'__version__\s+=\s+(?P<quote>[\'"])(?P<version>.*)(?P=quote)' + ) + + with io.open(version_file, encoding="utf-8") as f: + ver = _version_re.search(f.read()).group("version") + + return ver + + +def commit_for_release(version_file, ver): + run_step("git", "reset") + run_step("git", "add", version_file) + run_step("git", "commit", "--message", "Releasing version {}".format(ver)) + + +def create_git_tag(tag_name): + run_step("git", "tag", tag_name) + + +def create_distribution_files(): + run_step("python", "setup.py", "clean", "--all", "sdist", "bdist_wheel") + + +def upload_distribution_files(): + run_step("twine", "upload", "dist/*") + + +def push_to_github(): + run_step("git", "push", "origin", "master") + + +def push_tags_to_github(): + run_step("git", "push", "--tags", "origin") + + +def checklist(questions): + for question in questions: + if not click.confirm("--- {}".format(question), default=False): + sys.exit(1) + + +if __name__ == "__main__": + if DEBUG: + subprocess.check_output = lambda x: x + + checks = [ + "Have you updated the AUTHORS file?", + "Have you updated the `Usage` section of the README?", + ] + checklist(checks) + + ver = version("cli_helpers/__init__.py") + print("Releasing Version:", ver) + + parser = OptionParser() + parser.add_option( + "-c", + "--confirm-steps", + action="store_true", + dest="confirm_steps", + default=False, + help=( + "Confirm every step. If the step is not " "confirmed, it will be skipped." + ), + ) + parser.add_option( + "-d", + "--dry-run", + action="store_true", + dest="dry_run", + default=False, + help="Print out, but not actually run any steps.", + ) + + popts, pargs = parser.parse_args() + CONFIRM_STEPS = popts.confirm_steps + DRY_RUN = popts.dry_run + + if not click.confirm("Are you sure?", default=False): + sys.exit(1) + + commit_for_release("cli_helpers/__init__.py", ver) + create_git_tag("v{}".format(ver)) + create_distribution_files() + push_to_github() + push_tags_to_github() + upload_distribution_files() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/requirements-dev.txt new/cli_helpers-2.0.1/requirements-dev.txt --- old/cli_helpers-1.2.1/requirements-dev.txt 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/requirements-dev.txt 2020-05-28 00:09:35.000000000 +0200 @@ -1,7 +1,6 @@ autopep8==1.3.3 codecov==2.0.9 coverage==4.3.4 -mock==2.0.0 pep8radius Pygments>=2.4.0 pytest==3.0.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/setup.py new/cli_helpers-2.0.1/setup.py --- old/cli_helpers-1.2.1/setup.py 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/setup.py 2020-03-11 18:20:19.000000000 +0100 @@ -52,9 +52,7 @@ 'License :: OSI Approved :: BSD License', 'Operating System :: Unix', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Topic :: Software Development', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/tasks.py new/cli_helpers-2.0.1/tasks.py --- old/cli_helpers-1.2.1/tasks.py 2019-05-25 22:02:09.000000000 +0200 +++ new/cli_helpers-2.0.1/tasks.py 2020-05-26 23:23:40.000000000 +0200 @@ -48,7 +48,7 @@ def apply_option(self, cmd, option, active=True): """Apply a command-line option.""" return re.sub(r'{{{}\:(?P<option>[^}}]*)}}'.format(option), - '\g<option>' if active else '', cmd) + r'\g<option>' if active else '', cmd) class lint(BaseCommand): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/tests/tabular_output/test_output_formatter.py new/cli_helpers-2.0.1/tests/tabular_output/test_output_formatter.py --- old/cli_helpers-1.2.1/tests/tabular_output/test_output_formatter.py 2019-05-25 22:02:10.000000000 +0200 +++ new/cli_helpers-2.0.1/tests/tabular_output/test_output_formatter.py 2020-05-28 00:09:35.000000000 +0200 @@ -14,18 +14,27 @@ def test_tabular_output_formatter(): """Test the TabularOutputFormatter class.""" - data = [['abc', Decimal(1)], ['defg', Decimal('11.1')], - ['hi', Decimal('1.1')]] headers = ['text', 'numeric'] - expected = dedent('''\ - +------+---------+ - | text | numeric | - +------+---------+ - | abc | 1 | - | defg | 11.1 | - | hi | 1.1 | - +------+---------+''') + data = [ + ["abc", Decimal(1)], + ["defg", Decimal("11.1")], + ["hi", Decimal("1.1")], + ["Pablo\rß\n", 0], + ] + expected = dedent("""\ + +------------+---------+ + | text | numeric | + +------------+---------+ + | abc | 1 | + | defg | 11.1 | + | hi | 1.1 | + | Pablo\\rß\\n | 0 | + +------------+---------+""" + ) + print(expected) + print("\n".join(TabularOutputFormatter().format_output( + iter(data), headers, format_name='ascii'))) assert expected == "\n".join(TabularOutputFormatter().format_output( iter(data), headers, format_name='ascii')) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/tests/tabular_output/test_preprocessors.py new/cli_helpers-2.0.1/tests/tabular_output/test_preprocessors.py --- old/cli_helpers-1.2.1/tests/tabular_output/test_preprocessors.py 2019-06-09 13:52:10.000000000 +0200 +++ new/cli_helpers-2.0.1/tests/tabular_output/test_preprocessors.py 2020-05-26 23:23:40.000000000 +0200 @@ -40,6 +40,29 @@ assert expected == (list(results[0]), results[1]) [email protected](not HAS_PYGMENTS, reason='requires the Pygments library') +def test_override_missing_value_with_style(): + """Test that *override_missing_value()* styles output.""" + + class NullStyle(Style): + styles = { + Token.Output.Null: '#0f0' + } + + headers = ['h1', 'h2'] + data = [[None, '2'], ['abc', None]] + + expected_headers = ['h1', 'h2'] + expected_data = [ + ['\x1b[38;5;10m<null>\x1b[39m', '2'], + ['abc', '\x1b[38;5;10m<null>\x1b[39m'] + ] + results = override_missing_value(data, headers, + style=NullStyle, missing_value="<null>") + + assert (expected_data, expected_headers) == (list(results[0]), results[1]) + + def test_override_tab_value(): """Test the override_tab_value() function.""" data = [[1, '\tJohn'], [2, 'Jill']] @@ -169,6 +192,7 @@ assert (expected_data, expected_headers) == (list(results[0]), results[1]) + @pytest.mark.skipif(not HAS_PYGMENTS, reason='requires the Pygments library') def test_style_output_with_newlines(): """Test that *style_output()* styles output with newlines in it.""" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/tests/test_config.py new/cli_helpers-2.0.1/tests/test_config.py --- old/cli_helpers-1.2.1/tests/test_config.py 2019-05-25 22:02:10.000000000 +0200 +++ new/cli_helpers-2.0.1/tests/test_config.py 2020-05-28 00:09:35.000000000 +0200 @@ -4,7 +4,7 @@ from __future__ import unicode_literals import os -from mock import MagicMock +from unittest.mock import MagicMock import pytest from cli_helpers.compat import MAC, text_type, WIN diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cli_helpers-1.2.1/tox.ini new/cli_helpers-2.0.1/tox.ini --- old/cli_helpers-1.2.1/tox.ini 2019-05-25 22:02:10.000000000 +0200 +++ new/cli_helpers-2.0.1/tox.ini 2020-05-26 23:23:40.000000000 +0200 @@ -1,5 +1,5 @@ [tox] -envlist = cov-init, py27, py35, py36, py37, noextras, docs, packaging, cov-report +envlist = cov-init, py36, py37, noextras, docs, packaging, cov-report [testenv] passenv = CI TRAVIS TRAVIS_* CODECOV @@ -37,7 +37,7 @@ readme_renderer[md] -r{toxinidir}/requirements-dev.txt commands = - check-manifest + check-manifest --ignore .travis/* ./setup.py sdist twine check dist/* ./setup.py check -m -s
