Example #1
0
 def test_convert_job_footer(self):
     """Tests for maus_cpp.converter.X_repr() from MAUS.JobFooter"""
     maus_jf = make_test_job_footer()
     self.assertRaises(ValueError, converter.data_repr, (maus_jf,))
     json_dict = converter.json_repr(maus_jf)
     self.assertEqual(json_dict["maus_event_type"], "JobFooter")
     converter.job_footer_repr(json_dict)
     converter.string_repr(maus_jf)
Example #2
0
 def test_convert_job_header(self):
     """Tests for maus_cpp.converter.X_repr() from MAUS.JobHeader"""
     maus_jh = make_test_job_header()
     self.assertRaises(ValueError, converter.data_repr, (maus_jh,))
     json_dict = converter.json_repr(maus_jh)
     self.assertEqual(json_dict["maus_version"], "version")
     converter.job_header_repr(json_dict)
     converter.string_repr(maus_jh)
Example #3
0
 def test_convert_run_header(self):
     """Tests for maus_cpp.converter.X_repr() from MAUS.RunHeader"""
     maus_rh = make_test_run_header()
     self.assertRaises(ValueError, converter.data_repr, (maus_rh,))
     json_dict = converter.json_repr(maus_rh)
     self.assertEqual(json_dict["maus_event_type"], "RunHeader")
     converter.run_header_repr(json_dict)
     converter.string_repr(maus_rh)
Example #4
0
 def test_convert_data(self):
     """Tests for maus_cpp.converter.X_repr() to/from MAUS.Data"""
     maus_data = make_test_data()
     self.assertRaises(ValueError, converter.json_repr, (maus_data, ""))
     json_dict = converter.json_repr(maus_data)
     json_dict = converter.json_repr(maus_data)
     converter.json_repr(json_dict)
     converter.json_repr(json_dict)
     self.assertEqual(json_dict["spill_number"], 999)
     converter.data_repr(json_dict)
     converter.string_repr(maus_data)
Example #5
0
 def process(self, spill):
     """
     Process a spill by passing it through each member in turn,
     passing the result spill from one into the process function
     of the next.
     @param self Object reference.
     @param spill JSON spill document.
     @return result spill modified by the group members.
     """
     nu_spill = spill
     for worker in self._workers:
         if not (hasattr(worker, "can_convert") and worker.can_convert):
             old_spill = converter.string_repr(nu_spill)
             try:
                 converter.del_data_repr(nu_spill)
             except TypeError:
                 pass
             del nu_spill # should be no references to nu_spill left
         else:
             old_spill = nu_spill
             del nu_spill # should be no references to nu_spill left
         nu_spill = worker.process(old_spill)
         try:
             converter.del_data_repr(old_spill)
         except TypeError:
             pass
         del old_spill # should be no references to old_spill left
     return nu_spill
Example #6
0
 def process(self, spill):
     """
     Process a spill by passing it through each member in turn,
     passing the result spill from one into the process function
     of the next.
     @param self Object reference.
     @param spill JSON spill document.
     @return result spill modified by the group members.
     """
     nu_spill = spill
     for worker in self._workers:
         if not (hasattr(worker, "can_convert") and worker.can_convert):
             old_spill = converter.string_repr(nu_spill)
             try:
                 converter.del_data_repr(nu_spill)
             except TypeError:
                 pass
             del nu_spill  # should be no references to nu_spill left
         else:
             old_spill = nu_spill
             del nu_spill  # should be no references to nu_spill left
         nu_spill = worker.process(old_spill)
         try:
             converter.del_data_repr(old_spill)
         except TypeError:
             pass
         del old_spill  # should be no references to old_spill left
     return nu_spill