1
# This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
3
# MAUS is free software: you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation, either version 3 of the License, or
6
# (at your option) any later version.
8
# MAUS is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with MAUS. If not, see <http://www.gnu.org/licenses/>.
16
"""Tests for ReducePyTofCalib"""
17
# pylint: disable = C0103
22
from Configuration import Configuration
25
class ReducePyTofCalibTestCase(unittest.TestCase):# pylint: disable = R0904
26
"""Tests for ReducePyTofCalib"""
28
def setUpClass(cls): # pylint: disable = C0103
29
"""init a ReducePyTofCalib object"""
30
cls.reducer = MAUS.ReducePyTofCalib()
31
cls.c = Configuration()
34
"""Check against configuration is empty"""
35
# result = self.reducer.birth("")
36
# self.assertFalse(result)
37
result = self.reducer.process("")
38
doc = json.loads(result)
39
self.assertTrue("errors" in doc)
40
self.assertTrue("bad_json_document" in doc["errors"])
43
"""Check that birth works properly"""
44
success = self.reducer.birth(self. c.getConfigJSON())
45
self.assertTrue(success)
47
def test_no_data(self):
48
"""Check that against data stream is empty"""
49
test1 = ('%s/src/reduce/ReducePyTofCalib/noDataTest.txt' %
50
os.environ.get("MAUS_ROOT_DIR"))
54
result = self.reducer.process(data)
55
spill = json.loads(result)
57
if 'slab_hits' in spill:
59
self.assertTrue(no_slab_hits)
61
def test_process(self):
62
"""Check ReducePyTofCalib process function"""
63
test2 = ('%s/src/reduce/ReducePyTofCalib/processTest.txt' %
64
os.environ.get("MAUS_ROOT_DIR"))
67
# test with some crazy events.
68
self.reducer.process(data)
71
def tearDownClass(cls): # pylint: disable = C0103
72
"""Check that death works ok"""
73
success = cls.reducer.death()
75
raise Exception('InitializeFail', 'Could not start worker')
78
if __name__ == '__main__':