source: orange/Orange/testing/unit/tests/test_ensemble.py @ 10278:f3b1ffae9c29

Revision 10278:f3b1ffae9c29, 1.5 KB checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Unittest2 for python 2.6.

Line 
1try:
2    import unittest2 as unittest
3except:
4    import unittest
5
6from Orange.misc import testing
7from Orange.misc.testing import datasets_driven, test_on_datasets
8
9@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
10class TestBoosting(testing.LearnerTestCase):
11    def setUp(self):
12        import orngEnsemble, orngTree
13        self.learner = orngEnsemble.BoostedLearner(orngTree.TreeLearner)
14
15    @test_on_datasets(datasets=["iris"])
16    def test_pickling_on(self, dataset):
17        testing.LearnerTestCase.test_pickling_on(self, dataset)
18
19@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS + \
20                 testing.REGRESSION_DATASETS)
21class TestBagging(testing.LearnerTestCase):
22    def setUp(self):
23        import orngEnsemble, orngTree
24        self.learner = orngEnsemble.BaggedLearner(orngTree.TreeLearner)
25
26    @test_on_datasets(datasets=["iris"])
27    def test_pickling_on(self, dataset):
28        testing.LearnerTestCase.test_pickling_on(self, dataset)
29
30
31@datasets_driven(datasets=testing.CLASSIFICATION_DATASETS)
32class TestRandomForest(testing.LearnerTestCase):
33    def setUp(self):
34        import orngEnsemble, orngTree
35        self.learner = orngEnsemble.RandomForestLearner()
36
37    @test_on_datasets(datasets=testing.CLASSIFICATION_DATASETS + \
38                      testing.REGRESSION_DATASETS)
39    def test_pickling_on(self, dataset):
40        testing.LearnerTestCase.test_pickling_on(self, dataset)
41
42
43
44if __name__ == "__main__":
45    import unittest
46    unittest.main()
Note: See TracBrowser for help on using the repository browser.