Skip to content

Commit

Permalink
Try fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann committed Jul 31, 2022
1 parent a1db016 commit 4655e56
Showing 1 changed file with 12 additions and 34 deletions.
46 changes: 12 additions & 34 deletions tests/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def test_var_prefix_added_in_insertText(self) -> 'Generator':
'sortText': '0006USERPROFILE',
'label': 'USERPROFILE',
'additionalTextEdits': None,
'detail': None,
'data': None,
'kind': 6,
'command': None,
Expand Down Expand Up @@ -178,7 +177,6 @@ def test_pure_insertion_text_edit(self) -> 'Generator':
}
},
'label': '$someParam',
'filterText': None,
'data': None,
'command': None,
'detail': 'null',
Expand Down Expand Up @@ -612,8 +610,7 @@ def test_show_deprecated_flag(self) -> None:
"deprecated": True
} # type: CompletionItem
formatted_completion_item = format_completion(item_with_deprecated_flag, 0, False, "")
self.assertEqual('!', formatted_completion_item.kind[1])
self.assertEqual('⚠ Method - Deprecated', formatted_completion_item.kind[2])
self.assertIn("DEPRECATED", formatted_completion_item.annotation)

def test_show_deprecated_tag(self) -> None:
item_with_deprecated_tags = {
Expand All @@ -622,8 +619,7 @@ def test_show_deprecated_tag(self) -> None:
"tags": [CompletionItemTag.Deprecated]
} # type: CompletionItem
formatted_completion_item = format_completion(item_with_deprecated_tags, 0, False, "")
self.assertEqual('!', formatted_completion_item.kind[1])
self.assertEqual('⚠ Method - Deprecated', formatted_completion_item.kind[2])
self.assertIn("DEPRECATED", formatted_completion_item.annotation)

def test_strips_carriage_return_in_insert_text(self) -> 'Generator':
yield from self.verify(
Expand Down Expand Up @@ -662,37 +658,37 @@ def check(

check(
resolve_support=False,
expected_regex=r"^<p>f</p>$",
expected_regex=r"^f$",
label="f",
label_details=None
)
check(
resolve_support=False,
expected_regex=r"^<p><b>f</b>\(X&amp; x\)</p>$",
expected_regex=r"^f\(X&amp; x\)$",
label="f",
label_details={"detail": "(X& x)"}
)
check(
resolve_support=False,
expected_regex=r"^<p><b>f</b>\(X&amp; x\) - <i>does things</i></p>$",
expected_regex=r"^f\(X&amp; x\) \| does things$",
label="f",
label_details={"detail": "(X& x)", "description": "does things"}
)
check(
resolve_support=True,
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| <p>f</p>$",
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| f$",
label="f",
label_details=None
)
check(
resolve_support=True,
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| <p><b>f</b>\(X&amp; x\)</p>$",
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| f\(X&amp; x\)$",
label="f",
label_details={"detail": "(X& x)"}
)
check(
resolve_support=True,
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| <p><b>f</b>\(X&amp; x\) - <i>does things</i></p>$", # noqa: E501
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| f\(X&amp; x\) \| does things$", # noqa: E501
label="f",
label_details={"detail": "(X& x)", "description": "does things"}
)
Expand All @@ -709,41 +705,23 @@ def check(
if label_details is not None:
lsp["labelDetails"] = label_details
native = format_completion(lsp, 0, resolve_support, "")
self.assertRegex(native.details, expected_regex)
self.assertRegex(native.trigger, expected_regex)

check(
resolve_support=False,
expected_regex=r"^$",
expected_regex=r"^f$",
label="f",
label_details=None
)
check(
resolve_support=False,
expected_regex=r"^<p><b>f</b>\(X&amp; x\)</p>$",
expected_regex=r"^f\(X& x\)$",
label="f",
label_details={"detail": "(X& x)"}
)
check(
resolve_support=False,
expected_regex=r"^<p><b>f</b>\(X&amp; x\) - <i>does things</i></p>$",
label="f",
label_details={"detail": "(X& x)", "description": "does things"}
)
check(
resolve_support=True,
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a>$",
label="f",
label_details=None
)
check(
resolve_support=True,
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| <p><b>f</b>\(X&amp; x\)</p>$",
label="f",
label_details={"detail": "(X& x)"}
)
check(
resolve_support=True,
expected_regex=r"^<a href='subl:lsp_resolve_docs {\S+}'>More</a> \| <p><b>f</b>\(X&amp; x\) - <i>does things</i></p>$", # noqa: E501
expected_regex=r"^f\(X& x\)$",
label="f",
label_details={"detail": "(X& x)", "description": "does things"}
)
Expand Down

0 comments on commit 4655e56

Please sign in to comment.