class_docstr: Test DecisionBoundariesVisualizer
class_docstr_tok: ["Test","DecisionBoundariesVisualizer"]
docstr: Test the finalize method works as expected
docstr_tok: ["Test","the","finalize","method","works","as","expected"]
code: def test_finalize(self):
      """
      Test the finalize method works as expected
      """
      model = neighbors.KNeighborsClassifier(3)
      viz = DecisionBoundariesVisualizer(
          model, features=["one", "two"], show_scatter=False
      )
      fitted_viz = viz.fit(X_two_cols, y=y)
      fitted_viz.draw(X_two_cols, y=y)
  
      fitted_viz.ax = mock.Mock()
      fitted_viz.ax.legend = mock.MagicMock()
      fitted_viz.ax.set_xlabel = mock.MagicMock()
      fitted_viz.ax.set_ylabel = mock.MagicMock()
  
      fitted_viz.finalize()
  
      fitted_viz.ax.legend.assert_called_once_with(
          loc="best", frameon=True
      )
      fitted_viz.ax.set_xlabel.assert_called_once_with("one")
      fitted_viz.ax.set_ylabel.assert_called_once_with("two")
  
imports: import sys
  import pytest
  import numpy
  from unittest import mock
  from tests.base import VisualTestCase
  from yellowbrick.contrib.classifier import *
  from yellowbrick.exceptions import YellowbrickTypeError
  from yellowbrick.exceptions import YellowbrickValueError
  from sklearn import datasets
  from sklearn import neighbors
  from sklearn import naive_bayes
label_desc: Use image node_id 14 for calling the TestDecisionBoundariesVisualizer obj's underlying member method code with example usage: obj.test_finalize() without return types