Test display string cleaning in CompletionItem.
()
| 964 | |
| 965 | |
| 966 | def test_clean_display() -> None: |
| 967 | """Test display string cleaning in CompletionItem.""" |
| 968 | # Test all problematic characters being replaced by a single space. |
| 969 | # Also verify that \r\n is replaced by a single space. |
| 970 | display = "str1\r\nstr2\nstr3\rstr4\tstr5\fstr6\vstr7" |
| 971 | expected = "str1 str2 str3 str4 str5 str6 str7" |
| 972 | |
| 973 | # Since display defaults to text if not provided, we test both text and display fields |
| 974 | completion_item = CompletionItem("item", display=display, display_meta=display) |
| 975 | assert completion_item.display == expected |
| 976 | assert completion_item.display_meta == expected |
| 977 | |
| 978 | # Verify that text-derived display is also sanitized |
| 979 | text = "item\nwith\nnewlines" |
| 980 | expected_text_display = "item with newlines" |
| 981 | completion_item = CompletionItem(text) |
| 982 | assert completion_item.display == expected_text_display |
| 983 | |
| 984 | |
| 985 | def test_styled_completion_sort() -> None: |
nothing calls this directly
no test coverage detected
searching dependent graphs…