source: orange/Orange/testing/unit/tests/test_som.py @ 10317:80a86ca74082

Revision 10317:80a86ca74082, 1.6 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Added regression datasets to TestSOMSuporvised.

Line 
1from Orange.misc import testing
2from Orange.misc.testing import datasets_driven, test_on_data
3try:
4    import unittest2 as unittest
5except:
6    import unittest
7
8from Orange.projection import som
9
10def test_som_projection_helper(self, map, data):
11    pass
12
13@datasets_driven
14class TestSOM(testing.LearnerTestCase):
15    def setUp(self):
16        self.learner = som.SOMLearner
17
18    @test_on_data
19    def test_learner_on(self, dataset):
20        if dataset.domain.class_var:
21            # Test the learner/classification interface
22            testing.LearnerTestCase.test_learner_on(self, dataset)
23        else:
24            self.classifier = self.learner(dataset)
25        test_som_projection_helper(self, self.classifier, dataset)
26
27    @test_on_data
28    def test_pickling_on(self, dataset):
29        if dataset.domain.class_var:
30            testing.LearnerTestCase.test_pickling_on(self, dataset)
31
32
33@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS + \
34                 testing.REGRESSION_DATASETS)
35class TestSOMSupervised(testing.LearnerTestCase):
36    def setUp(self):
37        self.learner = som.SOMSupervisedLearner()
38
39    @test_on_data
40    def test_learner_on(self, dataset):
41        if dataset.domain.class_var:
42            # Test the learner/classification interface
43            testing.LearnerTestCase.test_learner_on(self, dataset)
44        else:
45            self.classifier = self.learner(dataset)
46        test_som_projection_helper(self, self.classifier, dataset)
47
48    @test_on_data
49    def test_pickling_on(self, dataset):
50        if dataset.domain.class_var:
51            testing.LearnerTestCase.test_pickling_on(self, dataset)
52
53
54
55if __name__ == "__main__":
56    unittest.main()
Note: See TracBrowser for help on using the repository browser.