File tree 2 files changed +26
-4
lines changed
2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,9 @@ def submit_pandas_labels(
78
78
else :
79
79
return
80
80
81
- if hasattr (cls , method_name ):
81
+ # Omit __call__, because its not implemented on the actual instances of
82
+ # DataFrame/Series, only as the constructor.
83
+ if method_name != "__call__" and hasattr (cls , method_name ):
82
84
method = getattr (cls , method_name )
83
85
else :
84
86
return
Original file line number Diff line number Diff line change @@ -157,11 +157,31 @@ def test_submit_pandas_labels_without_valid_params_for_param_logging(mock_bqclie
157
157
mock_bqclient .query .assert_not_called ()
158
158
159
159
160
- def test_submit_pandas_labels_with_internal_method (mock_bqclient ):
160
+ @pytest .mark .parametrize (
161
+ ("class_name" , "method_name" ),
162
+ (
163
+ ("Series" , "_repr_latex_" ),
164
+ (
165
+ "DataFrame" ,
166
+ # __call__ should be excluded.
167
+ # It's implemented on the pd.DataFrame class but not pd.DataFrame instances.
168
+ "__call__" ,
169
+ ),
170
+ (
171
+ "Series" ,
172
+ # __call__ should be excluded.
173
+ # It's implemented on the pd.Series class but not pd.Series instances.
174
+ "__call__" ,
175
+ ),
176
+ ),
177
+ )
178
+ def test_submit_pandas_labels_with_internal_method (
179
+ mock_bqclient , class_name , method_name
180
+ ):
161
181
log_adapter .submit_pandas_labels (
162
182
mock_bqclient ,
163
- "Series" ,
164
- "_repr_latex_" ,
183
+ class_name ,
184
+ method_name ,
165
185
task = log_adapter .PANDAS_API_TRACKING_TASK ,
166
186
)
167
187
mock_bqclient .query .assert_not_called ()
You can’t perform that action at this time.
0 commit comments