Test that the ranges we test for unicode names give the same number of results than testing the full length.
()
| 98 | |
| 99 | |
| 100 | def test_unicode_range(): |
| 101 | """ |
| 102 | Test that the ranges we test for unicode names give the same number of |
| 103 | results than testing the full length. |
| 104 | """ |
| 105 | |
| 106 | expected_list = _unicode_name_compute([(0, 0x110000)]) |
| 107 | test = _unicode_name_compute(_UNICODE_RANGES) |
| 108 | len_exp = len(expected_list) |
| 109 | len_test = len(test) |
| 110 | |
| 111 | # do not inline the len() or on error pytest will try to print the 130 000 + |
| 112 | # elements. |
| 113 | message = None |
| 114 | if len_exp != len_test or len_exp > 131808: |
| 115 | size, start, stop, prct = recompute_unicode_ranges() |
| 116 | message = f"""_UNICODE_RANGES likely wrong and need updating. This is |
| 117 | likely due to a new release of Python. We've find that the biggest gap |
| 118 | in unicode characters has reduces in size to be {size} characters |
| 119 | ({prct}), from {start}, to {stop}. In completer.py likely update to |
| 120 | |
| 121 | _UNICODE_RANGES = [(32, {start}), ({stop}, 0xe01f0)] |
| 122 | |
| 123 | And update the assertion below to use |
| 124 | |
| 125 | len_exp <= {len_exp} |
| 126 | """ |
| 127 | assert len_exp == len_test, message |
| 128 | |
| 129 | # fail if new unicode symbols have been added. |
| 130 | assert len_exp <= 159801, message |
| 131 | |
| 132 | |
| 133 | @contextmanager |
nothing calls this directly
no test coverage detected
searching dependent graphs…