Show More
@@ -34,6 +34,7 b' from IPython.core.completer import (' | |||
|
34 | 34 | # Test functions |
|
35 | 35 | # ----------------------------------------------------------------------------- |
|
36 | 36 | |
|
37 | ||
|
37 | 38 | def recompute_unicode_ranges(): |
|
38 | 39 | """ |
|
39 | 40 | utility to recompute the largest unicode range without any characters |
@@ -42,8 +43,9 b' def recompute_unicode_ranges():' | |||
|
42 | 43 | """ |
|
43 | 44 | import itertools |
|
44 | 45 | import unicodedata |
|
46 | ||
|
45 | 47 | valid = [] |
|
46 | for c in range(0,0x10FFFF + 1): | |
|
48 | for c in range(0, 0x10FFFF + 1): | |
|
47 | 49 | try: |
|
48 | 50 | unicodedata.name(chr(c)) |
|
49 | 51 | except ValueError: |
@@ -58,22 +60,28 b' def recompute_unicode_ranges():' | |||
|
58 | 60 | rg = list(ranges(valid)) |
|
59 | 61 | lens = [] |
|
60 | 62 | gap_lens = [] |
|
61 | pstart, pstop = 0,0 | |
|
63 | pstart, pstop = 0, 0 | |
|
62 | 64 | for start, stop in rg: |
|
63 | lens.append(stop-start) | |
|
64 | gap_lens.append((start - pstop, hex(pstop), hex(start), f'{round((start - pstop)/0xe01f0*100)}%')) | |
|
65 | lens.append(stop - start) | |
|
66 | gap_lens.append( | |
|
67 | ( | |
|
68 | start - pstop, | |
|
69 | hex(pstop + 1), | |
|
70 | hex(start), | |
|
71 | f"{round((start - pstop)/0xe01f0*100)}%", | |
|
72 | ) | |
|
73 | ) | |
|
65 | 74 | pstart, pstop = start, stop |
|
66 | 75 | |
|
67 | 76 | return sorted(gap_lens)[-1] |
|
68 | 77 | |
|
69 | 78 | |
|
70 | ||
|
71 | 79 | def test_unicode_range(): |
|
72 | 80 | """ |
|
73 | 81 | Test that the ranges we test for unicode names give the same number of |
|
74 | 82 | results than testing the full length. |
|
75 | 83 | """ |
|
76 |
from IPython.core.completer import |
|
|
84 | from IPython.core.completer import _unicode_name_compute, _UNICODE_RANGES | |
|
77 | 85 | |
|
78 | 86 | expected_list = _unicode_name_compute([(0, 0x110000)]) |
|
79 | 87 | test = _unicode_name_compute(_UNICODE_RANGES) |
@@ -98,8 +106,8 b' def test_unicode_range():' | |||
|
98 | 106 | """ |
|
99 | 107 | assert len_exp == len_test, message |
|
100 | 108 | |
|
101 |
# fail if new unicode symbols have been added. |
|
|
102 |
assert len_exp <= 143 |
|
|
109 | # fail if new unicode symbols have been added. | |
|
110 | assert len_exp <= 143668, message | |
|
103 | 111 | |
|
104 | 112 | |
|
105 | 113 | @contextmanager |
@@ -428,6 +436,10 b' class TestCompleter(unittest.TestCase):' | |||
|
428 | 436 | c = _("%ls foo")[0] |
|
429 | 437 | self.assertEqual(c.text, escaped) |
|
430 | 438 | |
|
439 | @pytest.mark.xfail( | |
|
440 | sys.version_info.releaselevel in ("alpha",), | |
|
441 | reason="Parso does not yet parse 3.13", | |
|
442 | ) | |
|
431 | 443 | def test_all_completions_dups(self): |
|
432 | 444 | """ |
|
433 | 445 | Make sure the output of `IPCompleter.all_completions` does not have |
@@ -446,6 +458,10 b' class TestCompleter(unittest.TestCase):' | |||
|
446 | 458 | matches = c.all_completions("TestClass.a") |
|
447 | 459 | assert matches == ['TestClass.a', 'TestClass.a1'], jedi_status |
|
448 | 460 | |
|
461 | @pytest.mark.xfail( | |
|
462 | sys.version_info.releaselevel in ("alpha",), | |
|
463 | reason="Parso does not yet parse 3.13", | |
|
464 | ) | |
|
449 | 465 | def test_jedi(self): |
|
450 | 466 | """ |
|
451 | 467 | A couple of issue we had with Jedi |
@@ -481,6 +497,10 b' class TestCompleter(unittest.TestCase):' | |||
|
481 | 497 | |
|
482 | 498 | _test_not_complete("does not mix types", 'a=(1,"foo");a[0].', "capitalize") |
|
483 | 499 | |
|
500 | @pytest.mark.xfail( | |
|
501 | sys.version_info.releaselevel in ("alpha",), | |
|
502 | reason="Parso does not yet parse 3.13", | |
|
503 | ) | |
|
484 | 504 | def test_completion_have_signature(self): |
|
485 | 505 | """ |
|
486 | 506 | Lets make sure jedi is capable of pulling out the signature of the function we are completing. |
@@ -496,6 +516,10 b' class TestCompleter(unittest.TestCase):' | |||
|
496 | 516 | "encoding" in c.signature |
|
497 | 517 | ), "Signature of function was not found by completer" |
|
498 | 518 | |
|
519 | @pytest.mark.xfail( | |
|
520 | sys.version_info.releaselevel in ("alpha",), | |
|
521 | reason="Parso does not yet parse 3.13", | |
|
522 | ) | |
|
499 | 523 | def test_completions_have_type(self): |
|
500 | 524 | """ |
|
501 | 525 | Lets make sure matchers provide completion type. |
@@ -531,6 +555,10 b' class TestCompleter(unittest.TestCase):' | |||
|
531 | 555 | assert len(l) == 1, "Completions (Z.z<tab>) correctly deduplicate: %s " % l |
|
532 | 556 | assert l[0].text == "zoo" # and not `it.accumulate` |
|
533 | 557 | |
|
558 | @pytest.mark.xfail( | |
|
559 | sys.version_info.releaselevel in ("alpha",), | |
|
560 | reason="Parso does not yet parse 3.13", | |
|
561 | ) | |
|
534 | 562 | def test_greedy_completions(self): |
|
535 | 563 | """ |
|
536 | 564 | Test the capability of the Greedy completer. |
@@ -1608,6 +1636,10 b' class TestCompleter(unittest.TestCase):' | |||
|
1608 | 1636 | configure(None) |
|
1609 | 1637 | _("--", ["completion_iter", "completion_list"]) |
|
1610 | 1638 | |
|
1639 | @pytest.mark.xfail( | |
|
1640 | sys.version_info.releaselevel in ("alpha",), | |
|
1641 | reason="Parso does not yet parse 3.13", | |
|
1642 | ) | |
|
1611 | 1643 | def test_matcher_suppression_with_jedi(self): |
|
1612 | 1644 | ip = get_ipython() |
|
1613 | 1645 | c = ip.Completer |
General Comments 0
You need to be logged in to leave comments.
Login now