##// END OF EJS Templates
Misc fix for Python 3.13 testing (unicode range and skip tests) (#14278)...
Matthias Bussonnier -
r28562:90276e81 merge
parent child Browse files
Show More
@@ -34,6 +34,7 b' from IPython.core.completer import ('
34 # Test functions
34 # Test functions
35 # -----------------------------------------------------------------------------
35 # -----------------------------------------------------------------------------
36
36
37
37 def recompute_unicode_ranges():
38 def recompute_unicode_ranges():
38 """
39 """
39 utility to recompute the largest unicode range without any characters
40 utility to recompute the largest unicode range without any characters
@@ -42,8 +43,9 b' def recompute_unicode_ranges():'
42 """
43 """
43 import itertools
44 import itertools
44 import unicodedata
45 import unicodedata
46
45 valid = []
47 valid = []
46 for c in range(0,0x10FFFF + 1):
48 for c in range(0, 0x10FFFF + 1):
47 try:
49 try:
48 unicodedata.name(chr(c))
50 unicodedata.name(chr(c))
49 except ValueError:
51 except ValueError:
@@ -58,22 +60,28 b' def recompute_unicode_ranges():'
58 rg = list(ranges(valid))
60 rg = list(ranges(valid))
59 lens = []
61 lens = []
60 gap_lens = []
62 gap_lens = []
61 pstart, pstop = 0,0
63 pstart, pstop = 0, 0
62 for start, stop in rg:
64 for start, stop in rg:
63 lens.append(stop-start)
65 lens.append(stop - start)
64 gap_lens.append((start - pstop, hex(pstop), hex(start), f'{round((start - pstop)/0xe01f0*100)}%'))
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 pstart, pstop = start, stop
74 pstart, pstop = start, stop
66
75
67 return sorted(gap_lens)[-1]
76 return sorted(gap_lens)[-1]
68
77
69
78
70
71 def test_unicode_range():
79 def test_unicode_range():
72 """
80 """
73 Test that the ranges we test for unicode names give the same number of
81 Test that the ranges we test for unicode names give the same number of
74 results than testing the full length.
82 results than testing the full length.
75 """
83 """
76 from IPython.core.completer import _unicode_name_compute, _UNICODE_RANGES
84 from IPython.core.completer import _unicode_name_compute, _UNICODE_RANGES
77
85
78 expected_list = _unicode_name_compute([(0, 0x110000)])
86 expected_list = _unicode_name_compute([(0, 0x110000)])
79 test = _unicode_name_compute(_UNICODE_RANGES)
87 test = _unicode_name_compute(_UNICODE_RANGES)
@@ -98,8 +106,8 b' def test_unicode_range():'
98 """
106 """
99 assert len_exp == len_test, message
107 assert len_exp == len_test, message
100
108
101 # fail if new unicode symbols have been added.
109 # fail if new unicode symbols have been added.
102 assert len_exp <= 143041, message
110 assert len_exp <= 143668, message
103
111
104
112
105 @contextmanager
113 @contextmanager
@@ -428,6 +436,10 b' class TestCompleter(unittest.TestCase):'
428 c = _("%ls foo")[0]
436 c = _("%ls foo")[0]
429 self.assertEqual(c.text, escaped)
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 def test_all_completions_dups(self):
443 def test_all_completions_dups(self):
432 """
444 """
433 Make sure the output of `IPCompleter.all_completions` does not have
445 Make sure the output of `IPCompleter.all_completions` does not have
@@ -446,6 +458,10 b' class TestCompleter(unittest.TestCase):'
446 matches = c.all_completions("TestClass.a")
458 matches = c.all_completions("TestClass.a")
447 assert matches == ['TestClass.a', 'TestClass.a1'], jedi_status
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 def test_jedi(self):
465 def test_jedi(self):
450 """
466 """
451 A couple of issue we had with Jedi
467 A couple of issue we had with Jedi
@@ -481,6 +497,10 b' class TestCompleter(unittest.TestCase):'
481
497
482 _test_not_complete("does not mix types", 'a=(1,"foo");a[0].', "capitalize")
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 def test_completion_have_signature(self):
504 def test_completion_have_signature(self):
485 """
505 """
486 Lets make sure jedi is capable of pulling out the signature of the function we are completing.
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 "encoding" in c.signature
516 "encoding" in c.signature
497 ), "Signature of function was not found by completer"
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 def test_completions_have_type(self):
523 def test_completions_have_type(self):
500 """
524 """
501 Lets make sure matchers provide completion type.
525 Lets make sure matchers provide completion type.
@@ -531,6 +555,10 b' class TestCompleter(unittest.TestCase):'
531 assert len(l) == 1, "Completions (Z.z<tab>) correctly deduplicate: %s " % l
555 assert len(l) == 1, "Completions (Z.z<tab>) correctly deduplicate: %s " % l
532 assert l[0].text == "zoo" # and not `it.accumulate`
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 def test_greedy_completions(self):
562 def test_greedy_completions(self):
535 """
563 """
536 Test the capability of the Greedy completer.
564 Test the capability of the Greedy completer.
@@ -1608,6 +1636,10 b' class TestCompleter(unittest.TestCase):'
1608 configure(None)
1636 configure(None)
1609 _("--", ["completion_iter", "completion_list"])
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 def test_matcher_suppression_with_jedi(self):
1643 def test_matcher_suppression_with_jedi(self):
1612 ip = get_ipython()
1644 ip = get_ipython()
1613 c = ip.Completer
1645 c = ip.Completer
General Comments 0
You need to be logged in to leave comments. Login now