HPS-MC
test_tools_lciodumpevent.py
Go to the documentation of this file.
1 import unittest
2 import configparser
3 
4 from hpsmc.tools import LCIODumpEvent
5 
6 
7 class TestLCIODumpEvent(unittest.TestCase):
8 
9  def test_init(self):
10  lcio_dump_event = LCIODumpEvent(event_num=10)
11  self.assertEqual(lcio_dump_event.name, "lcio_dump_event")
12  self.assertEqual(lcio_dump_event.command, "dumpevent")
13  self.assertEqual(lcio_dump_event.event_num, 10)
14 
16  lcio_dump_event = LCIODumpEvent()
17  self.assertEqual(lcio_dump_event.required_parameters(), [])
18 
20  lcio_dump_event = LCIODumpEvent()
21  self.assertEqual(lcio_dump_event.required_config(), ["lcio_dir"])
22 
23  def test_config(self):
24  lcio_dump_event = LCIODumpEvent()
25  parser = configparser.ConfigParser()
26  config_file = ['test_helpers/.hpsmc_test_cfg']
27  parser.read(config_file)
28  lcio_dump_event.config(parser)
29  self.assertEqual(lcio_dump_event.lcio_dir, "test_helpers/lciodir")
30 
31  def test_setup(self):
32  lcio_dump_event = LCIODumpEvent()
33  parser = configparser.ConfigParser()
34  config_file = ['test_helpers/.hpsmc_test_cfg']
35  parser.read(config_file)
36  lcio_dump_event.config(parser)
37  lcio_dump_event.setup()
38  self.assertEqual(lcio_dump_event.command, "test_helpers/lciodir/bin/dumpevent")
39 
40  def test_cmd_args(self):
41  lcio_dump_event = LCIODumpEvent(event_num=10, inputs=["some/path/to/input.slcio"])
42  parser = configparser.ConfigParser()
43  config_file = ['test_helpers/.hpsmc_test_cfg']
44  parser.read(config_file)
45  lcio_dump_event.config(parser)
46  self.assertEqual(lcio_dump_event.cmd_args(), ["some/path/to/input.slcio", "10"])
47 
48 
49 if __name__ == '__main__':
50  unittest.main()
Dump LCIO event information.
Definition: tools.py:1246
Tools that can be used in HPSMC jobs.
Definition: tools.py:1