(
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,
)
| 1084 | |
| 1085 | |
| 1086 | def 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 |
no test coverage detected