docstr: Assert that visual transformers can be added to pipelines
docstr_tok: ["Assert","that","visual","transformers","can","be","added","to","pipelines"]
code: def test_validate_steps(self):
      """
      Assert that visual transformers can be added to pipelines
      """
  
      # Pipeline objects have a _validate_steps method that raises an
      # TypeError if the steps don't match transforms --> estimator.
  
      # validate a bad intermediate transformer on the Pipeline
      with pytest.raises(TypeError):
          Pipeline(
              [
                  ("real", MockTransformer()),
                  ("bad", Thing()),
                  ("model", MockEstimator()),
              ]
          )
  
      # validate a bad intermediate transformer on the VisualPipeline
      with pytest.raises(TypeError):
          VisualPipeline(
              [
                  ("real", MockTransformer()),
                  ("bad", Thing()),
                  ("model", MockEstimator()),
              ]
          )
  
      # validate a bad final estimator on the Pipeline
      with pytest.raises(TypeError):
          Pipeline([("real", MockTransformer()), ("bad", Thing())])
  
      # validate a bad final estimator on the VisualPipeline
      with pytest.raises(TypeError):
          VisualPipeline(
              [("real", MockTransformer()), ("bad", Thing())]
          )
  
      # validate visual transformers on a Pipeline
      try:
          Pipeline(
              [
                  ("real", MockTransformer()),
                  ("visual", MockVisualTransformer()),
                  ("model", MockEstimator()),
              ]
          )
      except TypeError:
          self.fail("could not add a visual transformer to a Pipeline!")
  
      # validate visual transformers on a VisualPipeline
      try:
          VisualPipeline(
              [
                  ("real", MockTransformer()),
                  ("visual", MockVisualTransformer()),
                  ("model", MockEstimator()),
              ]
          )
      except TypeError:
          self.fail(
              "could not add a visual transformer to a VisualPipeline!"
          )
  
imports: import os
  import pytest
  from unittest import mock
  from yellowbrick.base import Visualizer
  from yellowbrick.pipeline import VisualPipeline
  from sklearn.pipeline import Pipeline
  from sklearn.base import BaseEstimator, TransformerMixin
label_desc: Use image node_id 1 for calling the TestVisualPipeline obj's underlying member method code with example usage: obj.test_validate_steps() without return types