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

Revision 10278:f3b1ffae9c29, 790 bytes 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
5import Orange
6from Orange.misc import testing
7import os, sys
8
9datasets = ["iris", "housing", ]
10
11def names_iter():
12    for n in datasets:
13        yield n, (n,)
14
15@testing.data_driven(data_iter=names_iter())
16class TestIO(unittest.TestCase):
17#    def setUp(self):
18#        Orange.data.io.set_search_paths()
19    @testing.test_on_data
20    def test_io_on(self, name):
21        table = Orange.data.Table(name)
22        for ext in ["tab", "svm", "arff"]: # TODO: add R, and C50
23            filename = name + "." + ext
24            try:
25                table.save(filename)
26                table_clone = Orange.data.Table(filename)
27            finally:
28                os.remove(filename)
29
30if __name__ == "__main__":
31    unittest.main()
Note: See TracBrowser for help on using the repository browser.