Hello community, here is the log from the commit of package python-pastel for openSUSE:Factory checked in at 2020-03-11 18:55:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pastel (Old) and /work/SRC/openSUSE:Factory/.python-pastel.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pastel" Wed Mar 11 18:55:52 2020 rev:2 rq:783954 version:0.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pastel/python-pastel.changes 2019-09-27 14:50:00.472521459 +0200 +++ /work/SRC/openSUSE:Factory/.python-pastel.new.3160/python-pastel.changes 2020-03-11 18:56:50.379714943 +0100 @@ -1,0 +2,7 @@ +Wed Mar 11 15:36:19 UTC 2020 - Marketa Calabkova <mcalabk...@suse.com> + +- update to version 0.2.0 + * few code formating fixes + * Add styling options + +------------------------------------------------------------------- Old: ---- pastel-0.1.1.tar.gz New: ---- pastel-0.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pastel.spec ++++++ --- /var/tmp/diff_new_pack.0zyTnr/_old 2020-03-11 18:56:50.695715084 +0100 +++ /var/tmp/diff_new_pack.0zyTnr/_new 2020-03-11 18:56:50.695715084 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pastel # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pastel -Version: 0.1.1 +Version: 0.2.0 Release: 0 Summary: String colorization for Python License: MIT @@ -48,6 +48,9 @@ %python_expand rm -r %{buildroot}%{$python_sitelib}/tests/ %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%pytest + %files %{python_files} %doc README.rst %license LICENSE ++++++ pastel-0.1.1.tar.gz -> pastel-0.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/PKG-INFO new/pastel-0.2.0/PKG-INFO --- old/pastel-0.1.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 +++ new/pastel-0.2.0/PKG-INFO 2019-12-16 01:40:16.745056000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pastel -Version: 0.1.1 +Version: 0.2.0 Summary: Bring colors to your terminal. Home-page: https://github.com/sdispater/pastel License: MIT @@ -15,6 +15,7 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Project-URL: Repository, https://github.com/sdispater/pastel Description-Content-Type: text/x-rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/pastel/__init__.py new/pastel-0.2.0/pastel/__init__.py --- old/pastel-0.1.1/pastel/__init__.py 2019-08-06 20:51:13.611902000 +0200 +++ new/pastel-0.2.0/pastel/__init__.py 2019-12-16 01:33:16.751403600 +0100 @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -__version__ = "0.1.1" +__version__ = "0.2.0" from .pastel import Pastel diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/pastel/pastel.py new/pastel-0.2.0/pastel/pastel.py --- old/pastel-0.1.1/pastel/pastel.py 2019-08-04 11:49:08.795909200 +0200 +++ new/pastel-0.2.0/pastel/pastel.py 2019-12-16 01:21:35.880997700 +0100 @@ -10,29 +10,29 @@ class Pastel(object): - TAG_REGEX = '[a-z][a-z0-9_=;-]*' - FULL_TAG_REGEX = re.compile('(?isx)<(({}) | /({})?)>'.format(TAG_REGEX, TAG_REGEX)) + TAG_REGEX = "[a-z][a-z0-9,_=;-]*" + FULL_TAG_REGEX = re.compile("(?isx)<(({}) | /({})?)>".format(TAG_REGEX, TAG_REGEX)) def __init__(self, colorized=False): self._colorized = colorized self._style_stack = StyleStack() self._styles = {} - self.add_style('error', 'white', 'red') - self.add_style('info', 'green') - self.add_style('comment', 'yellow') - self.add_style('question', 'black', 'cyan') + self.add_style("error", "white", "red") + self.add_style("info", "green") + self.add_style("comment", "yellow") + self.add_style("question", "black", "cyan") @classmethod def escape(cls, text): - return re.sub('(?is)([^\\\\]?)<', '\\1\\<', text) + return re.sub("(?is)([^\\\\]?)<", "\\1\\<", text) @contextmanager def colorized(self, colorized=None): is_colorized = self.is_colorized() if colorized is None: - colorized= sys.stdout.isatty() and is_colorized + colorized = sys.stdout.isatty() and is_colorized self.with_colors(colorized) @@ -60,12 +60,12 @@ def remove_style(self, name): if not self.has_style(name): - raise ValueError('Invalid style {}'.format(name)) + raise ValueError("Invalid style {}".format(name)) del self._styles[name] def colorize(self, message): - output = '' + output = "" tags = [] i = 0 for m in self.FULL_TAG_REGEX.finditer(message): @@ -78,7 +78,7 @@ i += 1 if not tags: - return message.replace('\\<', '<') + return message.replace("\\<", "<") offset = 0 for t in tags: @@ -87,18 +87,20 @@ endpos = t[4] if t[4] else -1 text = t[0] if prev_offset < offset - len(text): - output += self._apply_current_style(message[prev_offset:offset - len(text)]) + output += self._apply_current_style( + message[prev_offset : offset - len(text)] + ) - if offset != 0 and '\\' == message[offset - len(text) - 1]: + if offset != 0 and "\\" == message[offset - len(text) - 1]: output += self._apply_current_style(text) continue # opening tag? - open = '/' != text[1] + open = "/" != text[1] if open: tag = t[2] else: - tag = t[3] if t[3] else '' + tag = t[3] if t[3] else "" style = self._create_style_from_string(tag.lower()) if not open and not tag: @@ -117,26 +119,27 @@ output += self._apply_current_style(message[offset:]) - return output.replace('\\<', '<') + return output.replace("\\<", "<") def _create_style_from_string(self, string): if string in self._styles: return self._styles[string] - matches = re.findall('([^=]+)=([^;]+)(;|$)', string.lower()) + matches = re.findall("([^=]+)=([^;]+)(;|$)", string.lower()) if not len(matches): return False style = Style() for match in matches: - if match[0] == 'fg': + if match[0] == "fg": style.set_foreground(match[1]) - elif match[0] == 'bg': + elif match[0] == "bg": style.set_background(match[1]) else: try: - style.set_option(match[1]) + for option in match[1].split(","): + style.set_option(option.strip()) except ValueError: return False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/pastel/stack.py new/pastel-0.2.0/pastel/stack.py --- old/pastel-0.1.1/pastel/stack.py 2019-08-04 11:49:08.796243200 +0200 +++ new/pastel-0.2.0/pastel/stack.py 2019-12-16 01:19:29.594353200 +0100 @@ -4,7 +4,6 @@ class StyleStack(object): - def __init__(self, empty_style=None): self.empty_style = empty_style or Style() self.reset() @@ -24,11 +23,11 @@ for i, stacked_style in enumerate(reversed(self.styles)): if style == stacked_style: - self.styles = self.styles[:len(self.styles) - 1 - i] + self.styles = self.styles[: len(self.styles) - 1 - i] return stacked_style - raise ValueError('Incorrectly nested style tag found.') + raise ValueError("Incorrectly nested style tag found.") def get_current(self): if not len(self.styles): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/pastel/style.py new/pastel-0.2.0/pastel/style.py --- old/pastel-0.1.1/pastel/style.py 2019-08-04 11:49:08.796435400 +0200 +++ new/pastel-0.2.0/pastel/style.py 2019-12-16 01:22:02.616732100 +0100 @@ -6,33 +6,53 @@ class Style(object): FOREGROUND_COLORS = { - 'black': 30, - 'red': 31, - 'green': 32, - 'yellow': 33, - 'blue': 34, - 'magenta': 35, - 'cyan': 36, - 'white': 37 + "black": 30, + "red": 31, + "green": 32, + "yellow": 33, + "blue": 34, + "magenta": 35, + "cyan": 36, + "light_gray": 37, + "default": 39, + "dark_gray": 90, + "light_red": 91, + "light_green": 92, + "light_yellow": 93, + "light_blue": 94, + "light_magenta": 95, + "light_cyan": 96, + "white": 97, } BACKGROUND_COLORS = { - 'black': 40, - 'red': 41, - 'green': 42, - 'yellow': 43, - 'blue': 44, - 'magenta': 45, - 'cyan': 46, - 'white': 47 + "black": 40, + "red": 41, + "green": 42, + "yellow": 43, + "blue": 44, + "magenta": 45, + "cyan": 46, + "light_gray": 47, + "default": 49, + "dark_gray": 100, + "light_red": 101, + "light_green": 102, + "light_yellow": 103, + "light_blue": 104, + "light_magenta": 105, + "light_cyan": 106, + "white": 107, } OPTIONS = { - 'bold': 1, - 'underscore': 4, - 'blink': 5, - 'reverse': 7, - 'conceal': 8 + "bold": 1, + "dark": 2, + "italic": 3, + "underline": 4, + "blink": 5, + "reverse": 7, + "conceal": 8, } def __init__(self, foreground=None, background=None, options=None): @@ -68,10 +88,8 @@ def set_foreground(self, foreground): if foreground not in self.FOREGROUND_COLORS: raise ValueError( - 'Invalid foreground specified: "{}". Expected one of ({})' - .format( - foreground, - ', '.join(self.FOREGROUND_COLORS.keys()) + 'Invalid foreground specified: "{}". Expected one of ({})'.format( + foreground, ", ".join(self.FOREGROUND_COLORS.keys()) ) ) @@ -80,10 +98,8 @@ def set_background(self, background): if background not in self.FOREGROUND_COLORS: raise ValueError( - 'Invalid background specified: "{}". Expected one of ({})' - .format( - background, - ', '.join(self.BACKGROUND_COLORS.keys()) + 'Invalid background specified: "{}". Expected one of ({})'.format( + background, ", ".join(self.BACKGROUND_COLORS.keys()) ) ) @@ -92,10 +108,8 @@ def set_option(self, option): if option not in self.OPTIONS: raise ValueError( - 'Invalid option specified: "{}". Expected one of ({})' - .format( - option, - ', '.join(self.OPTIONS.keys()) + 'Invalid option specified: "{}". Expected one of ({})'.format( + option, ", ".join(self.OPTIONS.keys()) ) ) @@ -105,10 +119,8 @@ def unset_option(self, option): if not option in self.OPTIONS: raise ValueError( - 'Invalid option specified: "{}". Expected one of ({})' - .format( - option, - ', '.join(self.OPTIONS.keys()) + 'Invalid option specified: "{}". Expected one of ({})'.format( + option, ", ".join(self.OPTIONS.keys()) ) ) @@ -135,7 +147,7 @@ if not len(codes): return text - return '\033[%sm%s\033[0m' % (';'.join(map(str, codes)), text) + return "\033[%sm%s\033[0m" % (";".join(map(str, codes)), text) def __eq__(self, other): return ( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/pyproject.toml new/pastel-0.2.0/pyproject.toml --- old/pastel-0.1.1/pyproject.toml 2019-08-06 20:50:58.065059700 +0200 +++ new/pastel-0.2.0/pyproject.toml 2019-12-16 01:39:14.426426600 +0100 @@ -1,6 +1,6 @@ [tool.poetry] name = "pastel" -version = "0.1.1" +version = "0.2.0" description = "Bring colors to your terminal." authors = ["Sébastien Eustace <sebast...@eustace.io>"] license = "MIT" @@ -23,5 +23,5 @@ tox = "^3.13.2" [build-system] -requires = ["poetry>=0.12"] +requires = ["poetry>=1.0.0"] build-backend = "poetry.masonry.api" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/setup.py new/pastel-0.2.0/setup.py --- old/pastel-0.1.1/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pastel-0.2.0/setup.py 2019-12-16 01:40:16.744745000 +0100 @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from distutils.core import setup +from setuptools import setup packages = \ ['pastel', 'tests'] @@ -9,7 +9,7 @@ setup_kwargs = { 'name': 'pastel', - 'version': '0.1.1', + 'version': '0.2.0', 'description': 'Bring colors to your terminal.', 'long_description': "Pastel: Bring colors to your terminal\n#####################################\n\nPastel is a simple library to help you colorize strings in your terminal.\n\nIt comes bundled with predefined styles:\n\n* ``info``: green\n* ``comment``: yellow\n* ``question``: black on cyan\n* ``error``: white on red\n\n.. image:: https://raw.githubusercontent.com/sdispater/pastel/master/assets/screenshot.png\n\n\nFeatures\n========\n\n* Use predefined styles or add you own.\n* Disable colors all together by calling ``with_colors(False)``.\n* Automatically disables colors if the output is not a TTY.\n* Used in `cleo <https://github.com/sdispater/cleo>`_.\n* Supports Python **2.7+**, **3.5+** and **PyPy**.\n\n\nUsage\n=====\n\n.. code-block:: python\n\n >>> import pastel\n >>> print(pastel.colorize('<info>Information</info>'))\n 'Information' # Green string by default\n >>> print(pastel.colorize('<fg=red;options=bold>This is bold red</>'))\n 'This is bold red'\n\n\nInstallation\n============\n\n.. code-block::\n\n pip install pastel\n", 'author': 'Sébastien Eustace', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/tests/__init__.py new/pastel-0.2.0/tests/__init__.py --- old/pastel-0.1.1/tests/__init__.py 2019-08-04 11:49:08.797314600 +0200 +++ new/pastel-0.2.0/tests/__init__.py 2019-12-16 01:19:35.156848700 +0100 @@ -1,2 +1 @@ # -*- coding: utf-8 -*- - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/tests/test_api.py new/pastel-0.2.0/tests/test_api.py --- old/pastel-0.1.1/tests/test_api.py 2019-08-04 11:49:08.797682000 +0200 +++ new/pastel-0.2.0/tests/test_api.py 2019-12-16 01:19:35.223630000 +0100 @@ -7,7 +7,6 @@ class PseudoTTY(object): - def __init__(self, underlying): self._underlying = underlying @@ -30,27 +29,31 @@ def test_text(): with mock_stdout(): - assert '\033[32msome info\033[0m' == pastel.colorize('<info>some info</info>') + assert "\033[32msome info\033[0m" == pastel.colorize("<info>some info</info>") def test_colorize(): with mock_stdout(): pastel.with_colors(False) - assert 'some info' == pastel.colorize('<info>some info</info>') + assert "some info" == pastel.colorize("<info>some info</info>") pastel.with_colors(True) - assert '\033[32msome info\033[0m' == pastel.colorize('<info>some info</info>') + assert "\033[32msome info\033[0m" == pastel.colorize("<info>some info</info>") def test_add_remove_style(): with mock_stdout(): - pastel.add_style('success', 'green') + pastel.add_style("success", "green") - assert '\033[32msome info\033[0m' == pastel.colorize('<success>some info</success>') + assert "\033[32msome info\033[0m" == pastel.colorize( + "<success>some info</success>" + ) - pastel.remove_style('success') + pastel.remove_style("success") - assert '<success>some info</success>' == pastel.colorize('<success>some info</success>') + assert "<success>some info</success>" == pastel.colorize( + "<success>some info</success>" + ) def test_pastel(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/tests/test_pastel.py new/pastel-0.2.0/tests/test_pastel.py --- old/pastel-0.1.1/tests/test_pastel.py 2019-08-04 11:49:08.798050900 +0200 +++ new/pastel-0.2.0/tests/test_pastel.py 2019-12-16 01:29:30.887159800 +0100 @@ -6,174 +6,180 @@ def test_empty_tag(pastel): - assert 'foo<>bar' == pastel.colorize('foo<>bar') + assert "foo<>bar" == pastel.colorize("foo<>bar") def test_lg_char_escaping(pastel): - assert 'foo<bar' == pastel.colorize('foo\\<bar') - assert '<info>some info</info>' == pastel.colorize('\\<info>some info\\</info>') - assert '\\<info>some info\\</info>' == pastel.escape('<info>some info</info>') + assert "foo<bar" == pastel.colorize("foo\\<bar") + assert "<info>some info</info>" == pastel.colorize("\\<info>some info\\</info>") + assert "\\<info>some info\\</info>" == pastel.escape("<info>some info</info>") def test_bundled_styles(pastel): - assert pastel.has_style('error') - assert pastel.has_style('info') - assert pastel.has_style('comment') - assert pastel.has_style('question') - - assert '\033[37;41msome error\033[0m' == pastel.colorize('<error>some error</error>') - assert '\033[32msome info\033[0m' == pastel.colorize('<info>some info</info>') - assert '\033[33msome comment\033[0m' == pastel.colorize('<comment>some comment</comment>') - assert '\033[30;46msome question\033[0m' == pastel.colorize('<question>some question</question>') + assert pastel.has_style("error") + assert pastel.has_style("info") + assert pastel.has_style("comment") + assert pastel.has_style("question") + + assert "\033[97;41msome error\033[0m" == pastel.colorize( + "<error>some error</error>" + ) + assert "\033[32msome info\033[0m" == pastel.colorize("<info>some info</info>") + assert "\033[33msome comment\033[0m" == pastel.colorize( + "<comment>some comment</comment>" + ) + assert "\033[30;46msome question\033[0m" == pastel.colorize( + "<question>some question</question>" + ) def test_nested_styles(pastel): assert ( - '\033[37;41msome \033[0m\033[32msome info\033[0m\033[37;41m error\033[0m' - == - pastel.colorize('<error>some <info>some info</info> error</error>') + "\033[97;41msome \033[0m\033[32msome info\033[0m\033[97;41m error\033[0m" + == pastel.colorize("<error>some <info>some info</info> error</error>") ) def test_adjacent_style(pastel): - assert ( - '\033[37;41msome error\033[0m\033[32msome info\033[0m' - == - pastel.colorize('<error>some error</error><info>some info</info>') + assert "\033[97;41msome error\033[0m\033[32msome info\033[0m" == pastel.colorize( + "<error>some error</error><info>some info</info>" ) def test_style_matching_non_greedy(pastel): - assert ( - '(\033[32m>=2.0,<2.3\033[0m)' - == - pastel.colorize('(<info>>=2.0,<2.3</info>)') - ) + assert "(\033[32m>=2.0,<2.3\033[0m)" == pastel.colorize("(<info>>=2.0,<2.3</info>)") def test_style_escaping(pastel): - assert ( - '(\033[32mz>=2.0,<a2.3\033[0m)' - == - pastel.colorize('(<info>%s</info>)' % pastel.escape('z>=2.0,<a2.3')) + assert "(\033[32mz>=2.0,<a2.3\033[0m)" == pastel.colorize( + "(<info>%s</info>)" % pastel.escape("z>=2.0,<a2.3") ) def test_deep_nested_style(pastel): assert ( - '\033[37;41merror\033[0m\033[32minfo\033[0m\033[33mcomment\033[0m\033[37;41merror\033[0m' - == - pastel.colorize('<error>error<info>info<comment>comment</comment></info>error</error>') + "\033[97;41merror\033[0m\033[32minfo\033[0m\033[33mcomment\033[0m\033[97;41merror\033[0m" + == pastel.colorize( + "<error>error<info>info<comment>comment</comment></info>error</error>" + ) ) def test_new_style(pastel): - pastel.add_style('test', 'blue', 'white') + pastel.add_style("test", "blue", "white") - assert pastel.style('test') != pastel.style('info') + assert pastel.style("test") != pastel.style("info") - pastel.add_style('b', 'blue', 'white') + pastel.add_style("b", "blue", "white") assert ( - '\033[34;47msome \033[0m\033[34;47mcustom\033[0m\033[34;47m msg\033[0m' - == - pastel.colorize('<test>some <b>custom</b> msg</test>') + "\033[34;107msome \033[0m\033[34;107mcustom\033[0m\033[34;107m msg\033[0m" + == pastel.colorize("<test>some <b>custom</b> msg</test>") ) - pastel.remove_style('test') - pastel.remove_style('b') + pastel.remove_style("test") + pastel.remove_style("b") - assert ( - '<test>some <b>custom</b> msg</test>' - == - pastel.colorize('<test>some <b>custom</b> msg</test>') + assert "<test>some <b>custom</b> msg</test>" == pastel.colorize( + "<test>some <b>custom</b> msg</test>" ) with pytest.raises(ValueError): - pastel.remove_style('b') + pastel.remove_style("b") def test_redefined_style(pastel): - pastel.add_style('info', 'blue', 'white') + pastel.add_style("info", "blue", "white") - assert ( - '\033[34;47msome custom msg\033[0m' - == - pastel.colorize('<info>some custom msg</info>') + assert "\033[34;107msome custom msg\033[0m" == pastel.colorize( + "<info>some custom msg</info>" ) def test_inline_style(pastel): - assert '\033[34;41msome text\033[0m' == pastel.colorize('<fg=blue;bg=red>some text</>') - assert '\033[34;41msome text\033[0m' == pastel.colorize('<fg=blue;bg=red>some text</fg=blue;bg=red>') - assert '\033[34;41;1msome text\033[0m' == pastel.colorize('<fg=blue;bg=red;options=bold>some text</>') + assert "\033[34;41msome text\033[0m" == pastel.colorize( + "<fg=blue;bg=red>some text</>" + ) + assert "\033[34;41msome text\033[0m" == pastel.colorize( + "<fg=blue;bg=red>some text</fg=blue;bg=red>" + ) + assert "\033[34;41;1msome text\033[0m" == pastel.colorize( + "<fg=blue;bg=red;options=bold>some text</>" + ) def test_non_style_tag(pastel): expected = ( - '\033[32msome \033[0m\033[32m<tag>\033[0m\033[32m \033[0m\033[32m<setting=value>\033[0m\033[32m' - ' styled \033[0m\033[32m<p>\033[0m\033[32msingle-char tag\033[0m\033[32m</p>\033[0m' + "\033[32msome \033[0m\033[32m<tag>\033[0m\033[32m \033[0m\033[32m<setting=value>\033[0m\033[32m" + " styled \033[0m\033[32m<p>\033[0m\033[32msingle-char tag\033[0m\033[32m</p>\033[0m" ) - assert ( - expected - == - pastel.colorize('<info>some <tag> <setting=value> styled <p>single-char tag</p></info>') + assert expected == pastel.colorize( + "<info>some <tag> <setting=value> styled <p>single-char tag</p></info>" ) def test_non_decorated_pastel(non_decorated_pastel): pastel = non_decorated_pastel - assert pastel.has_style('error') - assert pastel.has_style('info') - assert pastel.has_style('comment') - assert pastel.has_style('question') - - assert 'some error' == pastel.colorize('<error>some error</error>') - assert 'some info' == pastel.colorize('<info>some info</info>') - assert 'some comment' == pastel.colorize('<comment>some comment</comment>') - assert 'some question'== pastel.colorize('<question>some question</question>') + assert pastel.has_style("error") + assert pastel.has_style("info") + assert pastel.has_style("comment") + assert pastel.has_style("question") + + assert "some error" == pastel.colorize("<error>some error</error>") + assert "some info" == pastel.colorize("<info>some info</info>") + assert "some comment" == pastel.colorize("<comment>some comment</comment>") + assert "some question" == pastel.colorize("<question>some question</question>") pastel.with_colors(True) - assert '\033[37;41msome error\033[0m' == pastel.colorize('<error>some error</error>') - assert '\033[32msome info\033[0m' == pastel.colorize('<info>some info</info>') - assert '\033[33msome comment\033[0m' == pastel.colorize('<comment>some comment</comment>') - assert '\033[30;46msome question\033[0m' == pastel.colorize('<question>some question</question>') + assert "\033[97;41msome error\033[0m" == pastel.colorize( + "<error>some error</error>" + ) + assert "\033[32msome info\033[0m" == pastel.colorize("<info>some info</info>") + assert "\033[33msome comment\033[0m" == pastel.colorize( + "<comment>some comment</comment>" + ) + assert "\033[30;46msome question\033[0m" == pastel.colorize( + "<question>some question</question>" + ) -@pytest.mark.parametrize("expected, message", [ - ( - """\033[32m +@pytest.mark.parametrize( + "expected, message", + [ + ( + """\033[32m some text\033[0m""", - """<info> -some text</info>""" - ), - ( - """\033[32msome text + """<info> +some text</info>""", + ), + ( + """\033[32msome text \033[0m""", - """<info>some text -</info>""" - ), - ( - """\033[32m + """<info>some text +</info>""", + ), + ( + """\033[32m some text \033[0m""", - """<info> + """<info> some text -</info>""" - ), - ( - """\033[32m +</info>""", + ), + ( + """\033[32m some text more text \033[0m""", - """<info> + """<info> some text more text -</info>""" - ) -]) +</info>""", + ), + ], +) def test_content_with_line_breaks(pastel, expected, message): assert expected == pastel.colorize(message) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/tests/test_stack.py new/pastel-0.2.0/tests/test_stack.py --- old/pastel-0.1.1/tests/test_stack.py 2019-08-04 11:49:08.798266600 +0200 +++ new/pastel-0.2.0/tests/test_stack.py 2019-12-16 01:19:35.255574700 +0100 @@ -6,22 +6,22 @@ def test_push(stack): - s1 = Style('white', 'black') - s2 = Style('yellow', 'blue') + s1 = Style("white", "black") + s2 = Style("yellow", "blue") stack.push(s1) stack.push(s2) assert s2 == stack.get_current() - s3 = Style('green', 'red') + s3 = Style("green", "red") stack.push(s3) assert s3 == stack.get_current() def test_pop(stack): - s1 = Style('white', 'black') - s2 = Style('yellow', 'blue') + s1 = Style("white", "black") + s2 = Style("yellow", "blue") stack.push(s1) stack.push(s2) @@ -34,9 +34,9 @@ def test_pop_not_last(stack): - s1 = Style('white', 'black') - s2 = Style('yellow', 'blue') - s3 = Style('green', 'red') + s1 = Style("white", "black") + s2 = Style("yellow", "blue") + s3 = Style("green", "red") stack.push(s1) stack.push(s2) stack.push(s3) @@ -46,8 +46,8 @@ def test_invalid_pop(stack): - s1 = Style('white', 'black') - s2 = Style('yellow', 'blue') + s1 = Style("white", "black") + s2 = Style("yellow", "blue") stack.push(s1) with pytest.raises(ValueError): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pastel-0.1.1/tests/test_style.py new/pastel-0.2.0/tests/test_style.py --- old/pastel-0.1.1/tests/test_style.py 2019-08-04 11:49:08.798429300 +0200 +++ new/pastel-0.2.0/tests/test_style.py 2019-12-16 01:25:37.655804600 +0100 @@ -6,66 +6,66 @@ def test_init(): - style = Style('green', 'black', ['bold', 'underscore']) - assert '\033[32;40;1;4mfoo\033[0m' == style.apply('foo') - assert 'green' == style.foreground - assert 'black' == style.background - assert ['bold', 'underscore'] == style.options + style = Style("green", "black", ["bold", "underline"]) + assert "\033[32;40;1;4mfoo\033[0m" == style.apply("foo") + assert "green" == style.foreground + assert "black" == style.background + assert ["bold", "underline"] == style.options - style = Style('red', None, ['blink']) - assert '\033[31;5mfoo\033[0m' == style.apply('foo') + style = Style("red", None, ["blink"]) + assert "\033[31;5mfoo\033[0m" == style.apply("foo") - style = Style(None, 'white') - assert '\033[47mfoo\033[0m' == style.apply('foo') + style = Style(None, "white") + assert "\033[107mfoo\033[0m" == style.apply("foo") - style = Style('red', None, 'blink') - assert '\033[31;5mfoo\033[0m' == style.apply('foo') + style = Style("red", None, "blink") + assert "\033[31;5mfoo\033[0m" == style.apply("foo") def test_foreground(style): - style.set_foreground('black') - assert '\033[30mfoo\033[0m' == style.apply('foo') + style.set_foreground("black") + assert "\033[30mfoo\033[0m" == style.apply("foo") - style.set_foreground('blue') - assert '\033[34mfoo\033[0m' == style.apply('foo') + style.set_foreground("blue") + assert "\033[34mfoo\033[0m" == style.apply("foo") with pytest.raises(ValueError): - style.set_foreground('undefined-color') + style.set_foreground("undefined-color") def test_background(style): - style.set_background('black') - assert '\033[40mfoo\033[0m' == style.apply('foo') + style.set_background("black") + assert "\033[40mfoo\033[0m" == style.apply("foo") - style.set_background('yellow') - assert '\033[43mfoo\033[0m' == style.apply('foo') + style.set_background("yellow") + assert "\033[43mfoo\033[0m" == style.apply("foo") with pytest.raises(ValueError): - style.set_background('undefined-color') + style.set_background("undefined-color") def test_options(style): - style.set_options(['reverse', 'conceal']) - assert '\033[7;8mfoo\033[0m' == style.apply('foo') + style.set_options(["reverse", "conceal"]) + assert "\033[7;8mfoo\033[0m" == style.apply("foo") - style.set_option('bold') - assert '\033[7;8;1mfoo\033[0m' == style.apply('foo') + style.set_option("bold") + assert "\033[7;8;1mfoo\033[0m" == style.apply("foo") - style.unset_option('reverse') - assert '\033[8;1mfoo\033[0m' == style.apply('foo') + style.unset_option("reverse") + assert "\033[8;1mfoo\033[0m" == style.apply("foo") - style.set_option('bold') - assert '\033[8;1mfoo\033[0m' == style.apply('foo') + style.set_option("bold") + assert "\033[8;1mfoo\033[0m" == style.apply("foo") - style.set_options(['bold']) - assert '\033[1mfoo\033[0m' == style.apply('foo') + style.set_options(["bold"]) + assert "\033[1mfoo\033[0m" == style.apply("foo") with pytest.raises(ValueError) as e: - style.set_option('foo') + style.set_option("foo") assert 'Invalid option specified: "foo"' in str(e.value) with pytest.raises(ValueError) as e: - style.unset_option('foo') + style.unset_option("foo") assert 'Invalid option specified: "foo"' in str(e.value)