Skip to content

Commit

Permalink
please linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Jan 8, 2024
1 parent 959b98a commit 4aa5884
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion IPython/core/completer.py
Expand Up @@ -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"]
Expand Down
42 changes: 33 additions & 9 deletions IPython/core/tests/test_completer.py
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -536,7 +554,10 @@ class Z:
assert len(l) == 1, "Completions (Z.z<tab>) 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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4aa5884

Please sign in to comment.