Assert#

class astroid.nodes.Assert(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]#

Bases: Statement

Class representing an ast.Assert node.

An Assert node represents an assert statement.

>>> import astroid
>>> node = astroid.extract_node('assert len(things) == 10, "Not enough things"')
>>> node
<Assert l.1 at 0x7effe1d527b8>
fail: NodeNG | None#

The message shown when the assertion fails.

get_children()[source]#

Get the child nodes below this node.

postinit(test: NodeNG, fail: NodeNG | None) None[source]#
test: NodeNG#

The test that passes or fails the assertion.