Skip to content

Fix end position in unittests #5904

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pylint/testutils/checker_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ def assertAddsMessages(
# pylint: disable=fixme
# TODO: Require end_line and end_col_offset and remove the warning
if not expected_msg.end_line == gotten_msg.end_line:
warnings.warn(
warnings.warn( # pragma: no cover
f"The end_line attribute of {gotten_msg} does not match "
f"the expected value in {expected_msg}. In pylint 3.0 correct end_line "
"attributes will be required for MessageTest.",
DeprecationWarning,
)
if not expected_msg.end_col_offset == gotten_msg.end_col_offset:
warnings.warn(
warnings.warn( # pragma: no cover
f"The end_col_offset attribute of {gotten_msg} does not match "
f"the expected value in {expected_msg}. In pylint 3.0 correct end_col_offset "
"attributes will be required for MessageTest.",
Expand Down
18 changes: 9 additions & 9 deletions tests/checkers/unittest_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class CLASSC(object): #@
confidence=HIGH,
line=2,
col_offset=0,
end_line=3,
end_col_offset=8,
end_line=2,
end_col_offset=12,
)
with self.assertAddsMessages(message):
cls = None
Expand Down Expand Up @@ -100,8 +100,8 @@ class CLASSC(object): #@
confidence=HIGH,
line=2,
col_offset=0,
end_line=3,
end_col_offset=8,
end_line=2,
end_col_offset=13,
),
MessageTest(
"invalid-name",
Expand All @@ -114,8 +114,8 @@ class CLASSC(object): #@
confidence=HIGH,
line=6,
col_offset=0,
end_line=7,
end_col_offset=8,
end_line=6,
end_col_offset=12,
),
]
with self.assertAddsMessages(*messages):
Expand Down Expand Up @@ -153,7 +153,7 @@ def FUNC(): #@
confidence=HIGH,
line=6,
col_offset=0,
end_line=7,
end_line=6,
end_col_offset=8,
)
with self.assertAddsMessages(message):
Expand Down Expand Up @@ -190,8 +190,8 @@ def UPPER(): #@
confidence=HIGH,
line=8,
col_offset=0,
end_line=9,
end_col_offset=8,
end_line=8,
end_col_offset=9,
)
with self.assertAddsMessages(message):
func = None
Expand Down