File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -503,6 +503,7 @@ def option_context(*args) -> Generator[None]:
503503        )
504504
505505    ops  =  tuple (zip (args [::2 ], args [1 ::2 ], strict = True ))
506+     undo : tuple [tuple [Any , Any ], ...] =  ()
506507    try :
507508        undo  =  tuple ((pat , get_option (pat )) for  pat , val  in  ops )
508509        for  pat , val  in  ops :
Original file line number Diff line number Diff line change @@ -491,3 +491,9 @@ def test_no_silent_downcasting_deprecated():
491491        cf .get_option ("future.no_silent_downcasting" )
492492    with  tm .assert_produces_warning (Pandas4Warning , match = "is deprecated" ):
493493        cf .set_option ("future.no_silent_downcasting" , True )
494+ 
495+ 
496+ def  test_option_context_invalid_option ():
497+     with  pytest .raises (OptionError , match = "No such keys" ):
498+         with  cf .option_context ("invalid" , True ):
499+             pass 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments