Skip to content

Commit

Permalink
ScatterPlot: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rekonder authored and astaric committed Jul 5, 2016
1 parent f999bda commit 429e4cf
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Orange/widgets/visualize/tests/test_owscatterplot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import numpy as np

from Orange.data import Table
from Orange.widgets.tests.base import GuiTest
from Orange.widgets.visualize.owscatterplot import OWScatterPlot


class TestOWScatterPlot(GuiTest):
def setUp(self):
self.widget = self.create_widget(OWScatterPlot)
self.data = Table("iris")

def tearDown(self):
self.widget.onDeleteWidget()

def test_set_data(self):
self.widget.set_data(self.data)
self.assertEqual(self.widget.data, self.data)
self.assertEqual(self.widget.subset_data, None)

def test_subset_data(self):
self.widget.set_subset_data(self.data[:30])
self.assertEqual(len(self.widget.subset_data), 30)
self.assertEqual(self.widget.data, None)
np.testing.assert_array_equal(self.widget.subset_data, self.data[:30])

def test_set_data_none(self):
self.widget.set_data(None)
self.assertEqual(self.widget.data, None)
self.assertEqual(self.widget.subset_data, None)

def test_subset_data_none(self):
self.widget.set_subset_data(None)
self.assertEqual(self.widget.subset_data, None)
self.assertEqual(self.widget.data, None)

0 comments on commit 429e4cf

Please sign in to comment.