@@ -315,8 +315,9 @@ def test_serialize_pipeline(self):
315315
316316 self .assertEqual (serialization .name , fixture_name )
317317 self .assertEqual (serialization .custom_name , fixture_short_name )
318- TestBase .logger .info ("\n \n test_serialize_pipeline\n ---------------------\n "
319- "{}\n \n {}\n \n " .format (serialization .description , fixture_description ))
318+ TestBase .logger .info ("\n \n test_serialize_pipeline\n ---------------------\n {}\n "
319+ "{}\n \n {}\n \n " .format (sklearn .__version__ , serialization .description ,
320+ fixture_description ))
320321 self .assertEqual (serialization .description , fixture_description )
321322 self .assertDictEqual (structure , fixture_structure )
322323
@@ -394,20 +395,35 @@ def test_serialize_pipeline_clustering(self):
394395 'scaler=sklearn.preprocessing.data.StandardScaler,' \
395396 'clusterer=sklearn.cluster.k_means_.KMeans)'
396397 fixture_short_name = 'sklearn.Pipeline(StandardScaler,KMeans)'
397- # str obtained from self.extension._get_sklearn_description(model)
398- fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially " \
399- "apply a list of transforms and a final estimator.\n Intermediate " \
400- "steps of the pipeline must be 'transforms', that is, they\n must " \
401- "implement fit and transform methods.\n The final estimator only " \
402- "needs to implement fit.\n The transformers in the pipeline can be " \
403- "cached using ``memory`` argument.\n \n The purpose of the pipeline is" \
404- " to assemble several steps that can be\n cross-validated together " \
405- "while setting different parameters.\n For this, it enables setting " \
406- "parameters of the various steps using their\n names and the " \
407- "parameter name separated by a '__', as in the example below.\n A " \
408- "step's estimator may be replaced entirely by setting the parameter" \
409- "\n with its name to another estimator, or a transformer removed " \
410- "by setting\n it to 'passthrough' or ``None``."
398+
399+ if version .parse (sklearn .__version__ ) >= version .parse ("0.21.0" ):
400+ fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially " \
401+ "apply a list of transforms and a final estimator.\n Intermediate " \
402+ "steps of the pipeline must be 'transforms', that is, they\n must " \
403+ "implement fit and transform methods.\n The final estimator only " \
404+ "needs to implement fit.\n The transformers in the pipeline can be " \
405+ "cached using ``memory`` argument.\n \n The purpose of the pipeline is" \
406+ " to assemble several steps that can be\n cross-validated together " \
407+ "while setting different parameters.\n For this, it enables setting " \
408+ "parameters of the various steps using their\n names and the " \
409+ "parameter name separated by a '__', as in the example below.\n A " \
410+ "step's estimator may be replaced entirely by setting the " \
411+ "parameter\n with its name to another estimator, or a transformer " \
412+ "removed by setting\n it to 'passthrough' or ``None``."
413+ else :
414+ fixture_description = "Pipeline of transforms with a final estimator.\n \n Sequentially" \
415+ " apply a list of transforms and a final estimator.\n Intermediate" \
416+ " steps of the pipeline must be 'transforms', that is, they\n must " \
417+ "implement fit and transform methods.\n The final estimator only " \
418+ "needs to implement fit.\n The transformers in the pipeline can " \
419+ "be cached using ``memory`` argument.\n \n The purpose of the " \
420+ "pipeline is to assemble several steps that can be\n " \
421+ "cross-validated together while setting different parameters." \
422+ "\n For this, it enables setting parameters of the various steps" \
423+ " using their\n names and the parameter name separated by a '__'," \
424+ " as in the example below.\n A step's estimator may be replaced " \
425+ "entirely by setting the parameter\n with its name to another " \
426+ "estimator, or a transformer removed by setting\n to None."
411427 fixture_structure = {
412428 fixture_name : [],
413429 'sklearn.preprocessing.data.StandardScaler' : ['scaler' ],
@@ -419,8 +435,9 @@ def test_serialize_pipeline_clustering(self):
419435
420436 self .assertEqual (serialization .name , fixture_name )
421437 self .assertEqual (serialization .custom_name , fixture_short_name )
422- TestBase .logger .info ("\n \n test_serialize_pipeline_clustering\n ---------------------\n "
423- "{}\n \n {}\n \n " .format (serialization .description , fixture_description ))
438+ TestBase .logger .info ("\n \n test_serialize_pipeline_clustering\n ---------------------\n {}\n "
439+ "{}\n \n {}\n \n " .format (sklearn .__version__ , serialization .description ,
440+ fixture_description ))
424441 self .assertEqual (serialization .description , fixture_description )
425442 self .assertDictEqual (structure , fixture_structure )
426443
0 commit comments