From 4aa588464085167c8bc1272fc000e2b0afc0903e Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Mon, 8 Jan 2024 10:18:34 +0100 Subject: [PATCH] please linter --- IPython/core/completer.py | 2 +- IPython/core/tests/test_completer.py | 42 ++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/IPython/core/completer.py b/IPython/core/completer.py index caf1ca7e6d8..7cc767691b7 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -285,7 +285,7 @@ def cast(type_, obj): # write this). With below range we cover them all, with a density of ~67% # biggest next gap we consider only adds up about 1% density and there are 600 # gaps that would need hard coding. -_UNICODE_RANGES = [(32, 0x323b0), (0xe0001, 0xe01f0)] +_UNICODE_RANGES = [(32, 0x323B0), (0xE0001, 0xE01F0)] # Public API __all__ = ["Completer", "IPCompleter"] diff --git a/IPython/core/tests/test_completer.py b/IPython/core/tests/test_completer.py index 705e9a72945..d765a4d2674 100644 --- a/IPython/core/tests/test_completer.py +++ b/IPython/core/tests/test_completer.py @@ -60,8 +60,15 @@ def ranges(i): gap_lens = [] pstart, pstop = 0,0 for start, stop in rg: - lens.append(stop-start) - gap_lens.append((start - pstop, hex(pstop+1), hex(start), f'{round((start - pstop)/0xe01f0*100)}%')) + lens.append(stop - start) + gap_lens.append( + ( + start - pstop, + hex(pstop + 1), + hex(start), + f"{round((start - pstop)/0xe01f0*100)}%", + ) + ) pstart, pstop = start, stop return sorted(gap_lens)[-1] @@ -428,7 +435,10 @@ def _(text): c = _("%ls foo")[0] self.assertEqual(c.text, escaped) - @pytest.mark.xfail(sys.version_info.releaselevel in ('alpha',), reason='Parso does not yet parse 3.13') + @pytest.mark.xfail( + sys.version_info.releaselevel in ("alpha",), + reason="Parso does not yet parse 3.13", + ) def test_all_completions_dups(self): """ Make sure the output of `IPCompleter.all_completions` does not have @@ -447,7 +457,10 @@ def test_all_completions_dups(self): matches = c.all_completions("TestClass.a") assert matches == ['TestClass.a', 'TestClass.a1'], jedi_status - @pytest.mark.xfail(sys.version_info.releaselevel in ('alpha',), reason='Parso does not yet parse 3.13') + @pytest.mark.xfail( + sys.version_info.releaselevel in ("alpha",), + reason="Parso does not yet parse 3.13", + ) def test_jedi(self): """ A couple of issue we had with Jedi @@ -483,8 +496,10 @@ def _test_not_complete(reason, s, comp): _test_not_complete("does not mix types", 'a=(1,"foo");a[0].', "capitalize") - - @pytest.mark.xfail(sys.version_info.releaselevel in ('alpha',), reason='Parso does not yet parse 3.13') + @pytest.mark.xfail( + sys.version_info.releaselevel in ("alpha",), + reason="Parso does not yet parse 3.13", + ) def test_completion_have_signature(self): """ Lets make sure jedi is capable of pulling out the signature of the function we are completing. @@ -500,7 +515,10 @@ def test_completion_have_signature(self): "encoding" in c.signature ), "Signature of function was not found by completer" - @pytest.mark.xfail(sys.version_info.releaselevel in ('alpha',), reason='Parso does not yet parse 3.13') + @pytest.mark.xfail( + sys.version_info.releaselevel in ("alpha",), + reason="Parso does not yet parse 3.13", + ) def test_completions_have_type(self): """ Lets make sure matchers provide completion type. @@ -536,7 +554,10 @@ class Z: assert len(l) == 1, "Completions (Z.z) correctly deduplicate: %s " % l assert l[0].text == "zoo" # and not `it.accumulate` - @pytest.mark.xfail(sys.version_info.releaselevel in ('alpha',), reason='Parso does not yet parse 3.13') + @pytest.mark.xfail( + sys.version_info.releaselevel in ("alpha",), + reason="Parso does not yet parse 3.13", + ) def test_greedy_completions(self): """ Test the capability of the Greedy completer. @@ -1614,7 +1635,10 @@ def configure(suppression_config): configure(None) _("--", ["completion_iter", "completion_list"]) - @pytest.mark.xfail(sys.version_info.releaselevel in ('alpha',), reason='Parso does not yet parse 3.13') + @pytest.mark.xfail( + sys.version_info.releaselevel in ("alpha",), + reason="Parso does not yet parse 3.13", + ) def test_matcher_suppression_with_jedi(self): ip = get_ipython() c = ip.Completer