@@ -2021,14 +2021,14 @@ def test_wait_for_pane_content_whitespace(wait_pane: Pane) -> None:
2021
2021
2022
2022
def test_invalid_match_type_combinations (wait_pane : Pane ) -> None :
2023
2023
"""Test various invalid match type combinations for wait functions.
2024
-
2024
+
2025
2025
This comprehensive test validates that appropriate errors are raised
2026
2026
when invalid combinations of patterns and match types are provided.
2027
2027
"""
2028
2028
# Prepare the pane
2029
2029
wait_pane .send_keys ("clear" , enter = True )
2030
2030
wait_until_pane_ready (wait_pane , timeout = 2.0 )
2031
-
2031
+
2032
2032
# Case 1: wait_for_any_content with mismatched lengths
2033
2033
with pytest .raises (ValueError ) as excinfo :
2034
2034
wait_for_any_content (
@@ -2039,54 +2039,54 @@ def test_invalid_match_type_combinations(wait_pane: Pane) -> None:
2039
2039
)
2040
2040
assert "match_types list" in str (excinfo .value )
2041
2041
assert "doesn't match patterns" in str (excinfo .value )
2042
-
2042
+
2043
2043
# Case 2: wait_for_any_content with invalid pattern type for CONTAINS
2044
- with pytest .raises (TypeError ) as excinfo :
2044
+ with pytest .raises (TypeError ) as excinfo_type_error :
2045
2045
wait_for_any_content (
2046
2046
wait_pane ,
2047
2047
[123 ], # type: ignore # Integer not valid for CONTAINS
2048
2048
ContentMatchType .CONTAINS ,
2049
2049
timeout = 0.5 ,
2050
2050
)
2051
- assert "must be a string" in str (excinfo .value )
2052
-
2051
+ assert "must be a string" in str (excinfo_type_error .value )
2052
+
2053
2053
# Case 3: wait_for_all_content with empty patterns list
2054
- with pytest .raises (ValueError ) as excinfo :
2054
+ with pytest .raises (ValueError ) as excinfo_empty :
2055
2055
wait_for_all_content (
2056
2056
wait_pane ,
2057
2057
[], # Empty patterns list
2058
2058
ContentMatchType .CONTAINS ,
2059
2059
timeout = 0.5 ,
2060
2060
)
2061
- assert "At least one content pattern" in str (excinfo .value )
2062
-
2061
+ assert "At least one content pattern" in str (excinfo_empty .value )
2062
+
2063
2063
# Case 4: wait_for_all_content with mismatched lengths
2064
- with pytest .raises (ValueError ) as excinfo :
2064
+ with pytest .raises (ValueError ) as excinfo_mismatch :
2065
2065
wait_for_all_content (
2066
2066
wait_pane ,
2067
2067
["pattern1" , "pattern2" ], # 2 patterns
2068
2068
[ContentMatchType .CONTAINS ], # Only 1 match type
2069
2069
timeout = 0.5 ,
2070
2070
)
2071
- assert "match_types list" in str (excinfo .value )
2072
- assert "doesn't match patterns" in str (excinfo .value )
2073
-
2071
+ assert "match_types list" in str (excinfo_mismatch .value )
2072
+ assert "doesn't match patterns" in str (excinfo_mismatch .value )
2073
+
2074
2074
# Case 5: wait_for_pane_content with wrong pattern type for PREDICATE
2075
- with pytest .raises (TypeError ) as excinfo :
2075
+ with pytest .raises (TypeError ) as excinfo_predicate :
2076
2076
wait_for_pane_content (
2077
2077
wait_pane ,
2078
2078
"not callable" , # String not valid for PREDICATE
2079
2079
ContentMatchType .PREDICATE ,
2080
2080
timeout = 0.5 ,
2081
2081
)
2082
- assert "must be callable" in str (excinfo .value )
2083
-
2082
+ assert "must be callable" in str (excinfo_predicate .value )
2083
+
2084
2084
# Case 6: Mixed match types with invalid pattern types
2085
- with pytest .raises (TypeError ) as excinfo :
2085
+ with pytest .raises (TypeError ) as excinfo_mixed :
2086
2086
wait_for_any_content (
2087
2087
wait_pane ,
2088
2088
["valid string" , re .compile (r"\d+" ), 123 ], # type: ignore
2089
2089
[ContentMatchType .CONTAINS , ContentMatchType .REGEX , ContentMatchType .EXACT ],
2090
2090
timeout = 0.5 ,
2091
2091
)
2092
- assert "Pattern at index 2" in str (excinfo .value )
2092
+ assert "Pattern at index 2" in str (excinfo_mixed .value )
0 commit comments