def test_draw_ax_show_scatter_False(self):
"""Test that the matplotlib functions are being called when the
scatter plot isn't drawn
"""
model = neighbors.KNeighborsClassifier(3)
viz = DecisionBoundariesVisualizer(
model, features=['one', 'two'], show_scatter=False)
fitted_viz = viz.fit(X_two_cols, y=y)
fitted_viz.ax = mock.Mock()
fitted_viz.ax.pcolormesh = mock.MagicMock()
fitted_viz.ax.scatter = mock.MagicMock()
fitted_viz.ax.legend = mock.MagicMock()
fitted_viz.draw(X_two_cols, y=y)
self.assertEquals(len(fitted_viz.ax.pcolormesh.mock_calls), 1)
self.assertEquals(len(fitted_viz.ax.scatter.mock_calls), 0)
self.assertEquals(len(fitted_viz.ax.legend.mock_calls), 1)
评论列表
文章目录