/opt/imh-python/lib/python3.9/site-packages/IPython/core/tests
NameSizeModeActions
daft_extension/-0755rm
__pycache__/-0755rm
2x2.jpg3310644editdlrm
2x2.png710644editdlrm
bad_all.py2060644editdlrm
nonascii.py1350644editdlrm
nonascii2.py1550644editdlrm
print_argv.py320644editdlrm
refbug.py14940644editdlrm
simpleerr.py5830644editdlrm
tclass.py9210644editdlrm
test_alias.py20070644editdlrm
test_application.py22450644editdlrm
test_async_helpers.py86470644editdlrm
test_autocall.py14250644editdlrm
test_compilerop.py21740644editdlrm
test_completer.py608030644editdlrm
test_completerlib.py65070644editdlrm
test_debugger.py145010644editdlrm
test_display.py159460644editdlrm
test_displayhook.py35930644editdlrm
test_events.py22870644editdlrm
test_exceptiongroup_tb.py35990644editdlrm
test_extension.py30260644editdlrm
test_formatters.py142490644editdlrm
test_guarded_eval.py156550644editdlrm
test_handlers.py32860644editdlrm
test_history.py116980644editdlrm
test_hooks.py23160644editdlrm
test_imports.py11530644editdlrm
test_inputsplitter.py232130644editdlrm
test_inputtransformer.py157550644editdlrm
test_inputtransformer2.py114080644editdlrm
test_inputtransformer2_line.py29710644editdlrm
test_interactiveshell.py396600644editdlrm
test_iplib.py66770644editdlrm
test_logger.py7760644editdlrm
test_magic.py443590644editdlrm
test_magic_arguments.py47780644editdlrm
test_magic_terminal.py59960644editdlrm
test_oinspect.py156740644editdlrm
test_page.py7720644editdlrm
test_paths.py70810644editdlrm
test_prefilter.py42140644editdlrm
test_profile.py50640644editdlrm
test_prompts.py8450644editdlrm
test_pylabtools.py78800644editdlrm
test_run.py193690644editdlrm
test_shellapp.py18920644editdlrm
test_splitinput.py12270644editdlrm
test_ultratb.py120260644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/IPython/core/tests/test_handlers.py (3286B)
"""Tests for input handlers. """ #----------------------------------------------------------------------------- # Module imports #----------------------------------------------------------------------------- # our own packages from IPython.core import autocall from IPython.testing import tools as tt #----------------------------------------------------------------------------- # Globals #----------------------------------------------------------------------------- # Get the public instance of IPython failures = [] num_tests = 0 #----------------------------------------------------------------------------- # Test functions #----------------------------------------------------------------------------- class CallableIndexable(object): def __getitem__(self, idx): return True def __call__(self, *args, **kws): return True class Autocallable(autocall.IPyAutocall): def __call__(self): return "called" def run(tests): """Loop through a list of (pre, post) inputs, where pre is the string handed to ipython, and post is how that string looks after it's been transformed (i.e. ipython's notion of _i)""" tt.check_pairs(ip.prefilter_manager.prefilter_lines, tests) def test_handlers(): call_idx = CallableIndexable() ip.user_ns['call_idx'] = call_idx # For many of the below, we're also checking that leading whitespace # turns off the esc char, which it should unless there is a continuation # line. run( [('"no change"', '"no change"'), # normal (u"lsmagic", "get_ipython().run_line_magic('lsmagic', '')"), # magic #("a = b # PYTHON-MODE", '_i'), # emacs -- avoids _in cache ]) # Objects which are instances of IPyAutocall are *always* autocalled autocallable = Autocallable() ip.user_ns['autocallable'] = autocallable # auto ip.run_line_magic("autocall", "0") # Only explicit escapes or instances of IPyAutocallable should get # expanded run( [ ('len "abc"', 'len "abc"'), ("autocallable", "autocallable()"), # Don't add extra brackets (gh-1117) ("autocallable()", "autocallable()"), ] ) ip.run_line_magic("autocall", "1") run( [ ('len "abc"', 'len("abc")'), ('len "abc";', 'len("abc");'), # ; is special -- moves out of parens # Autocall is turned off if first arg is [] and the object # is both callable and indexable. Like so: ("len [1,2]", "len([1,2])"), # len doesn't support __getitem__... ("call_idx [1]", "call_idx [1]"), # call_idx *does*.. ("call_idx 1", "call_idx(1)"), ("len", "len"), # only at 2 does it auto-call on single args ] ) ip.run_line_magic("autocall", "2") run( [ ('len "abc"', 'len("abc")'), ('len "abc";', 'len("abc");'), ("len [1,2]", "len([1,2])"), ("call_idx [1]", "call_idx [1]"), ("call_idx 1", "call_idx(1)"), # This is what's different: ("len", "len()"), # only at 2 does it auto-call on single args ] ) ip.run_line_magic("autocall", "1") assert failures == []