summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Drozd <nicholasdrozd@gmail.com>2023-04-04 16:14:16 -0400
committerGitHub <noreply@github.com>2023-04-04 20:14:16 +0000
commit299fcf6d79256b1d7423f872568a00c6ac78b118 (patch)
treea80e11dca7c6204ad7e40fa95dced667bee31ded
parentc1ae270bb990b00d681e677e6be31a2b5ce3c2e4 (diff)
downloadastroid-git-299fcf6d79256b1d7423f872568a00c6ac78b118.tar.gz
Mandatory fields for Assert (#2100)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
-rw-r--r--astroid/nodes/node_classes.py46
1 files changed, 5 insertions, 41 deletions
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py
index aeed360c..8092abcf 100644
--- a/astroid/nodes/node_classes.py
+++ b/astroid/nodes/node_classes.py
@@ -1013,49 +1013,13 @@ class Assert(_base_nodes.Statement):
_astroid_fields = ("test", "fail")
- def __init__(
- self,
- lineno: int | None = None,
- col_offset: int | None = None,
- parent: NodeNG | None = None,
- *,
- end_lineno: int | None = None,
- end_col_offset: int | None = None,
- ) -> None:
- """
- :param lineno: The line that this node appears on in the source code.
-
- :param col_offset: The column that this node appears on in the
- source code.
-
- :param parent: The parent node in the syntax tree.
-
- :param end_lineno: The last line this node appears on in the source code.
-
- :param end_col_offset: The end column this node appears on in the
- source code. Note: This is after the last symbol.
- """
- self.test: NodeNG | None = None
- """The test that passes or fails the assertion."""
-
- self.fail: NodeNG | None = None # can be None
- """The message shown when the assertion fails."""
-
- super().__init__(
- lineno=lineno,
- col_offset=col_offset,
- end_lineno=end_lineno,
- end_col_offset=end_col_offset,
- parent=parent,
- )
-
- def postinit(self, test: NodeNG | None = None, fail: NodeNG | None = None) -> None:
- """Do some setup after initialisation.
+ test: NodeNG
+ """The test that passes or fails the assertion."""
- :param test: The test that passes or fails the assertion.
+ fail: NodeNG | None
+ """The message shown when the assertion fails."""
- :param fail: The message shown when the assertion fails.
- """
+ def postinit(self, test: NodeNG, fail: NodeNG | None) -> None:
self.fail = fail
self.test = test