@@ -150,9 +150,7 @@ def test_namespaces_bytes_tuple_iterable(self, svg_root: _Element) -> None:
150150 .filter (lambda x : not is_iterator_of_nothing (x ))
151151 )
152152 @pytest .mark .slow
153- def test_namespaces_arg_bad (
154- self , disposable_element : _Element , thing : Any
155- ) -> None :
153+ def test_namespaces_arg_bad (self , disposable_element : _Element , thing : Any ) -> None :
156154 if isinstance (thing , Iterable ) or can_practically_iter (thing ):
157155 # pyrefly: ignore[no-matching-overload]
158156 raise_cm = pytest .raises ((TypeError , ValueError ))
@@ -188,9 +186,7 @@ def my_lower(context: Any, nodes: list[Any]) -> str:
188186 return str (nodes [0 ].text ).lower ()
189187 return ""
190188
191- ext : dict [tuple [None , str ], Callable [..., Any ]] = {
192- (None , "lower" ): my_lower
193- }
189+ ext : dict [tuple [None , str ], Callable [..., Any ]] = {(None , "lower" ): my_lower }
194190 result = xml2_root .xpath ("lower(//orderperson)" , extensions = ext )
195191 assert result == "john smith"
196192
@@ -200,9 +196,7 @@ def ext_func(context: Any, arg: Any) -> int:
200196
201197 ext_list = [{("http://ns1" , "func1" ): ext_func }]
202198 ns = {"ns1" : "http://ns1" }
203- result = xml2_root .xpath (
204- "ns1:func1('x')" , namespaces = ns , extensions = ext_list
205- )
199+ result = xml2_root .xpath ("ns1:func1('x')" , namespaces = ns , extensions = ext_list )
206200 assert result == 42
207201
208202 @settings (suppress_health_check = [HealthCheck .too_slow ], max_examples = 300 )
@@ -213,9 +207,7 @@ def ext_func(context: Any, arg: Any) -> int:
213207 .filter (lambda x : not is_iterator_of_nothing (x ))
214208 )
215209 @pytest .mark .slow
216- def test_extensions_arg_bad (
217- self , disposable_element : _Element , thing : Any
218- ) -> None :
210+ def test_extensions_arg_bad (self , disposable_element : _Element , thing : Any ) -> None :
219211 # pyrefly: ignore[no-matching-overload]
220212 with pytest .raises ((TypeError , AttributeError )):
221213 disposable_element .xpath ("//foo" , extensions = thing )
@@ -359,15 +351,11 @@ def test_path_arg_bad(self, thing: Any) -> None:
359351
360352
361353class TestXPathCall :
362- def test_call_element (
363- self , xml2_root : _Element
364- ) -> None :
354+ def test_call_element (self , xml2_root : _Element ) -> None :
365355 xpath_obj = XPath ("//item" )
366356 assert len (xpath_obj (xml2_root )) == 3
367357
368- def test_call_tree (
369- self , xml2_tree : _ElementTree
370- ) -> None :
358+ def test_call_tree (self , xml2_tree : _ElementTree ) -> None :
371359 xpath_obj = XPath ("//item" )
372360 assert len (xpath_obj (xml2_tree )) == 3
373361
@@ -592,13 +580,15 @@ def test_call_with_variables(self, xml2_root: _Element) -> None:
592580 assert len (result ) == 1
593581
594582 @settings (suppress_health_check = [HealthCheck .too_slow ], max_examples = 300 )
595- @given (thing = _st .all_instances_except_of_type (str , bytes , bytearray ))
583+ @given (
584+ thing = _st .all_instances_except_of_type (str , bytes , bytearray ).filter (
585+ lambda x : x is not NotImplemented and bool (x )
586+ )
587+ )
596588 @pytest .mark .slow
597- def test_call_path_bad_1 (
598- self , disposable_element : _Element , thing : Any
599- ) -> None :
589+ def test_call_path_bad_1 (self , disposable_element : _Element , thing : Any ) -> None :
600590 evaluator = XPathElementEvaluator (disposable_element )
601- with raise_unexpected_type :
591+ with raise_invalid_utf8_type :
602592 evaluator (thing ) # pyright: ignore[reportUnknownVariableType]
603593
604594 def test_call_returns_string (self , xml2_root : _Element ) -> None :
@@ -640,6 +630,7 @@ def test_register_namespaces_ok(self, svg_root: _Element) -> None:
640630
641631 # TODO Negative tests TBD
642632
633+
643634# -- XPathDocumentEvaluator tests --
644635
645636
@@ -691,9 +682,7 @@ def test_call_with_variables(self, xml2_tree: _ElementTree) -> None:
691682 @settings (suppress_health_check = [HealthCheck .too_slow ], max_examples = 300 )
692683 @given (thing = _st .all_instances_except_of_type (str , bytes , bytearray ))
693684 @pytest .mark .slow
694- def test_call_path_bad_1 (
695- self , disposable_element : _Element , thing : Any
696- ) -> None :
685+ def test_call_path_bad_1 (self , disposable_element : _Element , thing : Any ) -> None :
697686 evaluator = XPathDocumentEvaluator (disposable_element .getroottree ())
698687 with raise_invalid_utf8_type :
699688 evaluator (thing )
0 commit comments