File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -405,9 +405,12 @@ def fibonacci(target):
405405 #[ cfg( all( feature = "macros" , not( Py_LIMITED_API ) ) ) ]
406406 fn length_hint_error ( ) {
407407 #[ crate :: pyfunction( crate = "crate" ) ]
408- fn test_size_hint ( obj : & crate :: Bound < ' _ , crate :: PyAny > ) {
408+ fn test_size_hint ( obj : & crate :: Bound < ' _ , crate :: PyAny > , should_error : bool ) {
409409 let iter = obj. cast :: < PyIterator > ( ) . unwrap ( ) ;
410- assert_eq ! ( ( 0 , None ) , iter. size_hint( ) ) ;
410+ crate :: test_utils:: UnraisableCapture :: enter ( obj. py ( ) , |capture| {
411+ assert_eq ! ( ( 0 , None ) , iter. size_hint( ) ) ;
412+ assert_eq ! ( should_error, capture. take_capture( ) . is_some( ) ) ;
413+ } ) ;
411414 assert ! ( PyErr :: take( obj. py( ) ) . is_none( ) ) ;
412415 }
413416
@@ -431,8 +434,8 @@ def fibonacci(target):
431434 def __length_hint__(self):
432435 raise ValueError("bad hint impl")
433436
434- test_size_hint(NoHintIter())
435- test_size_hint(ErrorHintIter())
437+ test_size_hint(NoHintIter(), False )
438+ test_size_hint(ErrorHintIter(), True )
436439 "#
437440 ) ;
438441 } ) ;
You can’t perform that action at this time.
0 commit comments