diff options
author | smosker <smosker@yandex-team.ru> | 2022-02-10 16:48:21 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:21 +0300 |
commit | dd14d17a747a9c259858faf2fcc3ea6b92df4e15 (patch) | |
tree | f332cd81782832c17c48d8c3b4511924cd9e47fd /contrib/python/ipython/py2/IPython/testing | |
parent | b637e2fa3213638fbabe52c15dad14c8237945ac (diff) | |
download | ydb-dd14d17a747a9c259858faf2fcc3ea6b92df4e15.tar.gz |
Restoring authorship annotation for <smosker@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/ipython/py2/IPython/testing')
-rw-r--r-- | contrib/python/ipython/py2/IPython/testing/decorators.py | 24 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/testing/iptest.py | 20 | ||||
-rw-r--r-- | contrib/python/ipython/py2/IPython/testing/tools.py | 60 |
3 files changed, 52 insertions, 52 deletions
diff --git a/contrib/python/ipython/py2/IPython/testing/decorators.py b/contrib/python/ipython/py2/IPython/testing/decorators.py index c9807ce70e2..3f187732926 100644 --- a/contrib/python/ipython/py2/IPython/testing/decorators.py +++ b/contrib/python/ipython/py2/IPython/testing/decorators.py @@ -67,7 +67,7 @@ def as_unittest(func): # Utility functions -def apply_wrapper(wrapper, func): +def apply_wrapper(wrapper, func): """Apply a wrapper to a function for decoration. This mixes Michele Simionato's decorator tool with nose's make_decorator, @@ -76,14 +76,14 @@ def apply_wrapper(wrapper, func): This will ensure that wrapped functions can still be well introspected via IPython, for example. """ - warnings.warn("The function `apply_wrapper` is deprecated since IPython 4.0", - DeprecationWarning, stacklevel=2) + warnings.warn("The function `apply_wrapper` is deprecated since IPython 4.0", + DeprecationWarning, stacklevel=2) import nose.tools return decorator(wrapper,nose.tools.make_decorator(func)(wrapper)) -def make_label_dec(label, ds=None): +def make_label_dec(label, ds=None): """Factory function to create a decorator that applies one or more labels. Parameters @@ -128,8 +128,8 @@ def make_label_dec(label, ds=None): True """ - warnings.warn("The function `make_label_dec` is deprecated since IPython 4.0", - DeprecationWarning, stacklevel=2) + warnings.warn("The function `make_label_dec` is deprecated since IPython 4.0", + DeprecationWarning, stacklevel=2) if isinstance(label, string_types): labels = [label] else: @@ -285,8 +285,8 @@ def decorated_dummy(dec, name): import IPython.testing.decorators as dec setup = dec.decorated_dummy(dec.skip_if_no_x11, __name__) """ - warnings.warn("The function `decorated_dummy` is deprecated since IPython 4.0", - DeprecationWarning, stacklevel=2) + warnings.warn("The function `decorated_dummy` is deprecated since IPython 4.0", + DeprecationWarning, stacklevel=2) dummy = lambda: None dummy.__name__ = name return dec(dummy) @@ -319,8 +319,8 @@ skip_if_no_x11 = skipif(_x11_skip_cond, _x11_skip_msg) # not a decorator itself, returns a dummy function to be used as setup def skip_file_no_x11(name): - warnings.warn("The function `skip_file_no_x11` is deprecated since IPython 4.0", - DeprecationWarning, stacklevel=2) + warnings.warn("The function `skip_file_no_x11` is deprecated since IPython 4.0", + DeprecationWarning, stacklevel=2) return decorated_dummy(skip_if_no_x11, name) if _x11_skip_cond else None # Other skip decorators @@ -375,8 +375,8 @@ def onlyif_any_cmd_exists(*commands): """ Decorator to skip test unless at least one of `commands` is found. """ - warnings.warn("The function `onlyif_any_cmd_exists` is deprecated since IPython 4.0", - DeprecationWarning, stacklevel=2) + warnings.warn("The function `onlyif_any_cmd_exists` is deprecated since IPython 4.0", + DeprecationWarning, stacklevel=2) for cmd in commands: if which(cmd): return null_deco diff --git a/contrib/python/ipython/py2/IPython/testing/iptest.py b/contrib/python/ipython/py2/IPython/testing/iptest.py index 4018264125c..ed6d55d9bc7 100644 --- a/contrib/python/ipython/py2/IPython/testing/iptest.py +++ b/contrib/python/ipython/py2/IPython/testing/iptest.py @@ -50,16 +50,16 @@ if sys.version_info > (3,0): warnings.filterwarnings('error', message=".*{'config': True}.*", category=DeprecationWarning, module='IPy.*') warnings.filterwarnings('default', message='.*', category=Warning, module='IPy.*') -warnings.filterwarnings('error', message='.*apply_wrapper.*', category=DeprecationWarning, module='.*') -warnings.filterwarnings('error', message='.*make_label_dec', category=DeprecationWarning, module='.*') -warnings.filterwarnings('error', message='.*decorated_dummy.*', category=DeprecationWarning, module='.*') -warnings.filterwarnings('error', message='.*skip_file_no_x11.*', category=DeprecationWarning, module='.*') -warnings.filterwarnings('error', message='.*onlyif_any_cmd_exists.*', category=DeprecationWarning, module='.*') - -warnings.filterwarnings('error', message='.*disable_gui.*', category=DeprecationWarning, module='.*') - -warnings.filterwarnings('error', message='.*ExceptionColors global is deprecated.*', category=DeprecationWarning, module='.*') - +warnings.filterwarnings('error', message='.*apply_wrapper.*', category=DeprecationWarning, module='.*') +warnings.filterwarnings('error', message='.*make_label_dec', category=DeprecationWarning, module='.*') +warnings.filterwarnings('error', message='.*decorated_dummy.*', category=DeprecationWarning, module='.*') +warnings.filterwarnings('error', message='.*skip_file_no_x11.*', category=DeprecationWarning, module='.*') +warnings.filterwarnings('error', message='.*onlyif_any_cmd_exists.*', category=DeprecationWarning, module='.*') + +warnings.filterwarnings('error', message='.*disable_gui.*', category=DeprecationWarning, module='.*') + +warnings.filterwarnings('error', message='.*ExceptionColors global is deprecated.*', category=DeprecationWarning, module='.*') + if version_info < (6,): # nose.tools renames all things from `camelCase` to `snake_case` which raise an # warning with the runner they also import from standard import library. (as of Dec 2015) diff --git a/contrib/python/ipython/py2/IPython/testing/tools.py b/contrib/python/ipython/py2/IPython/testing/tools.py index 23bf6a68cb2..1a2ba6fd436 100644 --- a/contrib/python/ipython/py2/IPython/testing/tools.py +++ b/contrib/python/ipython/py2/IPython/testing/tools.py @@ -7,8 +7,8 @@ Authors from __future__ import absolute_import -# Copyright (c) IPython Development Team. -# Distributed under the terms of the Modified BSD License. +# Copyright (c) IPython Development Team. +# Distributed under the terms of the Modified BSD License. import os import re @@ -18,11 +18,11 @@ import tempfile from contextlib import contextmanager from io import StringIO from subprocess import Popen, PIPE -try: - from unittest.mock import patch -except ImportError: - # Python 2 compatibility - from mock import patch +try: + from unittest.mock import patch +except ImportError: + # Python 2 compatibility + from mock import patch try: # These tools are used by parts of the runtime, so we make the nose @@ -438,28 +438,28 @@ def make_tempfile(name): finally: os.unlink(name) -def fake_input(inputs): - """Temporarily replace the input() function to return the given values - - Use as a context manager: - - with fake_input(['result1', 'result2']): - ... - - Values are returned in order. If input() is called again after the last value - was used, EOFError is raised. - """ - it = iter(inputs) - def mock_input(prompt=''): - try: - return next(it) - except StopIteration: - raise EOFError('No more inputs given') - - input_name = '%s.%s' % (py3compat.builtin_mod_name, - 'input' if py3compat.PY3 else 'raw_input') - return patch(input_name, mock_input) - +def fake_input(inputs): + """Temporarily replace the input() function to return the given values + + Use as a context manager: + + with fake_input(['result1', 'result2']): + ... + + Values are returned in order. If input() is called again after the last value + was used, EOFError is raised. + """ + it = iter(inputs) + def mock_input(prompt=''): + try: + return next(it) + except StopIteration: + raise EOFError('No more inputs given') + + input_name = '%s.%s' % (py3compat.builtin_mod_name, + 'input' if py3compat.PY3 else 'raw_input') + return patch(input_name, mock_input) + def help_output_test(subcommand=''): """test that `ipython [subcommand] -h` works""" cmd = get_ipython_cmd() + [subcommand, '-h'] @@ -478,6 +478,6 @@ def help_all_output_test(subcommand=''): nt.assert_equal(rc, 0, err) nt.assert_not_in("Traceback", err) nt.assert_in("Options", out) - nt.assert_in("Class", out) + nt.assert_in("Class", out) return out, err |