ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since c09ac449 was
daa56d0,
checked in by Mathieu Doucet <doucetm@…>, 16 years ago
|
Mostly completed DataLoader?. Reimplemented using REFL registry as base class. Added writing capability and dynamic loading of readers (need zip file support for future py2exe use). All tests pass.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | from DataLoader.loader import Loader |
---|
2 | import unittest |
---|
3 | |
---|
4 | class testLoader(unittest.TestCase): |
---|
5 | def setUp(self): |
---|
6 | self.s = Loader() |
---|
7 | |
---|
8 | def test_load_unknown(self): |
---|
9 | """ |
---|
10 | self.s.load('blah.mat') on an unknown type |
---|
11 | should raise a ValueError exception (thrown by data_util.registry) |
---|
12 | """ |
---|
13 | self.assertRaises(ValueError, self.s.load, 'angles_flat.mat') |
---|
14 | |
---|
15 | def test_corrupt(self): |
---|
16 | """ |
---|
17 | Loading a corrupted file with a known extension |
---|
18 | should raise a runtime exception. |
---|
19 | The error condition is similar to an unknown |
---|
20 | type (file extension). When a reader is identified as |
---|
21 | knowing the file extension, it tries to load. If it |
---|
22 | raises an exception, the system should try to identify |
---|
23 | another reader that knows about that file extension. |
---|
24 | If they all fail, we raise a runtime exception stating |
---|
25 | that no reader was found for this file. |
---|
26 | """ |
---|
27 | self.assertRaises(RuntimeError, self.s.load, 'corrupt.png') |
---|
28 | |
---|
29 | |
---|
30 | if __name__ == '__main__': |
---|
31 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.