1 | import unittest |
---|
2 | from mantid.simpleapi import * |
---|
3 | from mantid.api import IEventWorkspace |
---|
4 | import isis_reduction_steps as steps |
---|
5 | |
---|
6 | class SliceEventTest(unittest.TestCase): |
---|
7 | class ReducerWrapper(): |
---|
8 | tstart = None |
---|
9 | tstop = None |
---|
10 | def set_slices(self, tstart, tstop): |
---|
11 | self.tstart = tstart |
---|
12 | self.tstop = tstop |
---|
13 | def getSlicesLimits(self): |
---|
14 | return self.tstart, self.tstop |
---|
15 | |
---|
16 | def setUp(self): |
---|
17 | config['default.instrument'] = 'SANS2D' |
---|
18 | |
---|
19 | def test_normal(self): |
---|
20 | ws = LoadEventNexus('22048') |
---|
21 | slicer = steps.SliceEvent() |
---|
22 | reducer = self.ReducerWrapper() |
---|
23 | |
---|
24 | reducer.set_slices(0.1, 200.0) |
---|
25 | slicer.execute(reducer, ws) |
---|
26 | point = mtd['ws'] |
---|
27 | |
---|
28 | self.assertTrue(not isinstance(point, IEventWorkspace)) |
---|
29 | |
---|
30 | def test_do_not_slice(self): |
---|
31 | ws = LoadEventNexus('22048') |
---|
32 | slicer = steps.SliceEvent() |
---|
33 | reducer = self.ReducerWrapper() |
---|
34 | |
---|
35 | slicer.execute(reducer, ws) |
---|
36 | point = mtd['ws'] |
---|
37 | |
---|
38 | self.assertTrue(not isinstance(point, IEventWorkspace)) |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | if __name__ == "__main__": |
---|
43 | unittest.main() |
---|
44 | |
---|