class_docstr: Tests for the high-level API of Yellowbrick and base classes
class_docstr_tok: ["Tests","for","the","high-level","API","of","Yellowbrick","and","base","classes"]
docstr: Test show calls plt.savefig and other figure finalization correctly
code: def test_show_savefig_interface(self, mock_plt):
      """
      Test show calls plt.savefig and other figure finalization correctly
      """
  
      class CustomVisualizer(Visualizer):
          pass
  
      _, ax = plt.subplots()
      viz = CustomVisualizer(ax=ax)
      viz.finalize = MagicMock()
      assert viz.show(outpath="test.png") is ax
  
      viz.finalize.assert_called_once_with()
      mock_plt.show.assert_not_called()
      mock_plt.savefig.assert_called_once_with("test.png")
  
imports: import pytest
  import matplotlib.pyplot
  from yellowbrick.base import *
  from yellowbrick.base import VisualizerGrid
  from yellowbrick.datasets import load_occupancy
  from yellowbrick.exceptions import YellowbrickWarning
  from yellowbrick.exceptions import YellowbrickValueError
  from unittest.mock import patch
  from unittest.mock import MagicMock
  from tests.rand import RandomVisualizer
  from tests.base import IS_WINDOWS_OR_CONDA, VisualTestCase
  from sklearn.svm import LinearSVC
  from sklearn.datasets import make_classification
label_desc: Use image node_id 8 for calling the TestBaseClasses obj's underlying member method code with example usage: obj.test_show_savefig_interface(mock_plt) without return types