@@ -99,7 +99,7 @@ def or_(i: float) -> bool:
9999
100100def make_and (cond1 : UnaryCheck , cond2 : UnaryCheck ) -> UnaryCheck :
101101 def and_ (i : float ) -> bool :
102- return cond1 (i ) or cond2 (i )
102+ return cond1 (i ) and cond2 (i )
103103
104104 return and_
105105
@@ -778,6 +778,14 @@ def check_result(i: float, result: float) -> bool:
778778 return check_result
779779
780780
781+ def make_complex_unary_check_result (check_fn : Callable [[complex ], bool ]) -> UnaryResultCheck :
782+ """Wraps a complex check function for use in UnaryCase."""
783+ def check_result (in_value , out_value ):
784+ # in_value is complex, out_value is complex
785+ return check_fn (out_value )
786+ return check_result
787+
788+
781789def parse_unary_case_block (case_block : str , func_name : str ) -> List [UnaryCase ]:
782790 """
783791 Parses a Sphinx-formatted docstring of a unary function to return a list of
@@ -849,14 +857,7 @@ def parse_unary_case_block(case_block: str, func_name: str) -> List[UnaryCase]:
849857 )
850858 _check_result , result_expr = parse_complex_result (result_str )
851859
852- # Create a wrapper that works with complex inputs
853- def make_complex_check_result (check_fn ):
854- def check_result (in_value , out_value ):
855- # in_value is complex, out_value is complex
856- return check_fn (out_value )
857- return check_result
858-
859- check_result = make_complex_check_result (_check_result )
860+ check_result = make_complex_unary_check_result (_check_result )
860861
861862 case = UnaryCase (
862863 cond_expr = cond_expr ,
0 commit comments