aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/ipython/py2/IPython/testing/tools.py
diff options
context:
space:
mode:
authorsmosker <smosker@yandex-team.ru>2022-02-10 16:48:22 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:48:22 +0300
commit01fa2667d0e5e868b18424bc1906146e5ee340db (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /contrib/python/ipython/py2/IPython/testing/tools.py
parentdd14d17a747a9c259858faf2fcc3ea6b92df4e15 (diff)
downloadydb-01fa2667d0e5e868b18424bc1906146e5ee340db.tar.gz
Restoring authorship annotation for <smosker@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/ipython/py2/IPython/testing/tools.py')
-rw-r--r--contrib/python/ipython/py2/IPython/testing/tools.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/contrib/python/ipython/py2/IPython/testing/tools.py b/contrib/python/ipython/py2/IPython/testing/tools.py
index 1a2ba6fd43..23bf6a68cb 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