@@ -237,13 +237,9 @@ def test_score_sample_weight():
237
237
238
238
239
239
def test_clone_pandas_dataframe ():
240
- class MockDataFrameWithEq (MockDataFrame ):
241
- """implemenets __eq__ operator to leverage the current test."""
242
- def __eq__ (self , other ):
243
- return self .array == other .array
244
240
245
241
class DummyEstimator (BaseEstimator , TransformerMixin ):
246
- """This is a dummpy class for generating numerical features
242
+ """This is a dummy class for generating numerical features
247
243
248
244
This feature extractor extracts numerical features from pandas data
249
245
frame.
@@ -257,9 +253,9 @@ class DummyEstimator(BaseEstimator, TransformerMixin):
257
253
Notes
258
254
-----
259
255
"""
260
- def __init__ (self , df , toto ):
256
+ def __init__ (self , df = None , scalar_param = 1 ):
261
257
self .df = df
262
- self .toto = toto
258
+ self .scalar_param = scalar_param
263
259
264
260
def fit (self , X , y = None ):
265
261
pass
@@ -269,9 +265,10 @@ def transform(self, X, y=None):
269
265
270
266
# build and clone estimator
271
267
d = np .arange (10 )
272
- df = MockDataFrameWithEq (d )
273
- e = DummyEstimator (df , toto = 1 )
268
+ df = MockDataFrame (d )
269
+ e = DummyEstimator (df , scalar_param = 1 )
274
270
cloned_e = clone (e )
275
271
276
272
# the test
277
- assert_equal (e .toto , cloned_e .toto )
273
+ assert_true ((e .df == cloned_e .df ).values .all ())
274
+ assert_equal (e .scalar_param , cloned_e .scalar_param )
0 commit comments