File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -94,13 +94,14 @@ def test_if_delegate_has_method():
9494class AvailableParameterEstimator :
9595 """This estimator's `available` parameter toggles the presence of a method"""
9696
97- def __init__ (self , available = True ):
97+ def __init__ (self , available = True , return_value = 1 ):
9898 self .available = available
99+ self .return_value = return_value
99100
100101 @available_if (lambda est : est .available )
101102 def available_func (self ):
102103 """This is a mock available_if function"""
103- pass
104+ return self . return_value
104105
105106
106107def test_available_if_docstring ():
@@ -164,5 +165,8 @@ def test_available_if_methods_can_be_pickled():
164165
165166 Non-regression test for #21344.
166167 """
167- est = AvailableParameterEstimator (available = True )
168- pickle .dumps (est .available_func )
168+ return_value = 10
169+ est = AvailableParameterEstimator (available = True , return_value = return_value )
170+ pickled_bytes = pickle .dumps (est .available_func )
171+ unpickled_func = pickle .loads (pickled_bytes )
172+ assert unpickled_func () == return_value
You can’t perform that action at this time.
0 commit comments