def test_generate_pipeline_code():
 pipeline = ['KNeighborsClassifier', ['CombineDFs', ['GradientBoostingClassifier', 'input_matrix', 38.0, 0.87], ['GaussianNB', ['ZeroCount', 'input_matrix']]], 18, 33]
 expected_code = 'make_pipeline(\n    make_union(\n        make_union(VotingClassifier([(\'branch\',\n            GradientBoostingClassifier(learning_rate=1.0, max_features=1.0, n_estimators=500)\n        )]), FunctionTransformer(lambda X: X)),\n        make_union(VotingClassifier([(\'branch\',\n            make_pipeline(\n                ZeroCount(),\n                GaussianNB()\n            )\n        )]), FunctionTransformer(lambda X: X))\n    ),\n    KNeighborsClassifier(n_neighbors=5, weights="distance")\n)'
 assert (expected_code == generate_pipeline_code(pipeline))

def test_generate_pipeline_code ( ) : pipeline = [ 'KNeighborsClassifier' , [ 'CombineDFs' , [ 'GradientBoostingClassifier' , 'input_matrix' , 38.0 , 0.87 ] , [ 'GaussianNB' , [ 'ZeroCount' , 'input_matrix' ] ] ] , 18 , 33 ] expected_code = 'make_pipeline(\n    make_union(\n        make_union(VotingClassifier([(\'branch\',\n            GradientBoostingClassifier(learning_rate=1.0, max_features=1.0, n_estimators=500)\n        )]), FunctionTransformer(lambda X: X)),\n        make_union(VotingClassifier([(\'branch\',\n            make_pipeline(\n                ZeroCount(),\n                GaussianNB()\n            )\n        )]), FunctionTransformer(lambda X: X))\n    ),\n    KNeighborsClassifier(n_neighbors=5, weights="distance")\n)' assert ( expected_code == generate_pipeline_code ( pipeline ) )
assert that generate_pipeline_code() returns the correct code given a specific pipeline .