Skip to content

String matchers

StringContaining

Matches any string that contains the given substring

Parameters:

Name Type Description Default
substring str

string that should be contained within other object

required

LinesLike

Matches text similar to the given text, but can display diffs of multiple lines. Empty lines are ignored.

Parameters:

Name Type Description Default
lines list[str]

text to match

required
ignore_case bool

whether to ignore the case of characters. Defaults to True.

True
ignored_sequences Optional[Iterable[str]]

sequences of characters to ignore in the string. Defaults to None.

None
strip_lines bool

whether to strip each line before processing. Defaults to False.

False

TextLike

Matches text that is similar to the given text.

Can ignore case, and sequences of characters.

Parameters:

Name Type Description Default
text str

text to match

required
ignore_case bool

whether to ignore the case of characters. Defaults to True.

True
ignored_sequences Optional[Iterable[str]]

sequences of characters to ignore in the string. Defaults to None.

None
strip bool

whether to strip the text before processing. Defaults to False.

False

StringMatchingRegex

Matches strings that match with the given regular expression.

Parameters:

Name Type Description Default
regex str

regular expression to match against

required