text_lint.exceptions.assertions.AssertionViolation

class text_lint.exceptions.assertions.AssertionViolation(assertion: AssertionBase, expected: str, textfile: TextFileSequencer)[source]

Bases: AssertionExceptionBase

Raised when a parser assertion fails.

__init__(assertion: AssertionBase, expected: str, textfile: TextFileSequencer) None[source]

Initialize AssertionViolation exceptions.

Parameters:
  • assertion (AssertionBase) – The assertion operation with the violation.

  • expected (str) – The expected string content.

  • textfile (TextFileSequencer) – The textfile sequencer object being used.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.