MCPcopy Index your code
hub / github.com/microsoft/playwright-python / to_expected_text_values

Function to_expected_text_values

playwright/_impl/_assertions.py:1086–1113  ·  view source on GitHub ↗
(
    items: Union[
        Sequence[Pattern[str]], Sequence[str], Sequence[Union[str, Pattern[str]]]
    ],
    match_substring: bool = False,
    normalize_white_space: bool = False,
    ignoreCase: Optional[bool] = None,
)

Source from the content-addressed store, hash-verified

1084
1085
1086def to_expected_text_values(
1087 items: Union[
1088 Sequence[Pattern[str]], Sequence[str], Sequence[Union[str, Pattern[str]]]
1089 ],
1090 match_substring: bool = False,
1091 normalize_white_space: bool = False,
1092 ignoreCase: Optional[bool] = None,
1093) -> Sequence[ExpectedTextValue]:
1094 out: List[ExpectedTextValue] = []
1095 assert isinstance(items, (list, tuple))
1096 for item in items:
1097 if isinstance(item, str):
1098 o = ExpectedTextValue(
1099 string=item,
1100 matchSubstring=match_substring,
1101 normalizeWhiteSpace=normalize_white_space,
1102 ignoreCase=ignoreCase,
1103 )
1104 if o["ignoreCase"] is None:
1105 del o["ignoreCase"]
1106 out.append(o)
1107 elif isinstance(item, Pattern):
1108 out.append(
1109 expected_regex(item, match_substring, normalize_white_space, ignoreCase)
1110 )
1111 else:
1112 raise Error("value must be a string or regular expression")
1113 return out

Callers 15

to_have_titleMethod · 0.85
to_have_urlMethod · 0.85
to_contain_textMethod · 0.85
to_have_attributeMethod · 0.85
to_have_classMethod · 0.85
to_contain_classMethod · 0.85
to_have_cssMethod · 0.85
to_have_idMethod · 0.85
to_have_valueMethod · 0.85
to_have_valuesMethod · 0.85
to_have_textMethod · 0.85

Calls 4

ExpectedTextValueClass · 0.90
ErrorClass · 0.90
expected_regexFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected