Skip to content
Snippets Groups Projects
Commit 42e5b0f9 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-815: more checks for integer types.

parent 3a4d56a5
No related branches found
No related tags found
2 merge requests!59Merge LOFAR-Release-4_0 into master,!55Resolve SW-815
...@@ -208,7 +208,14 @@ class PreschedulerTest(unittest.TestCase): ...@@ -208,7 +208,14 @@ class PreschedulerTest(unittest.TestCase):
def test_CobaltOTDBsettings(self): def test_CobaltOTDBsettings(self):
otdb_info = cobaltOTDBsettings(self.test_cobalt_settings) otdb_info = cobaltOTDBsettings(self.test_cobalt_settings)
# beware! assertEqual succeeds for a comparison between 42.0 and 42
# but for lofar specs it is essential that some values are int
# so, check specifically for those!
self.assertEqual(otdb_info, self.otdb_info) self.assertEqual(otdb_info, self.otdb_info)
self.assertEqual(int, type(otdb_info['LOFAR.ObsSW.Observation.ObservationControl.OnlineControl.Cobalt.Correlator.nrBlocksPerIntegration']))
self.assertEqual(int, type(otdb_info['LOFAR.ObsSW.Observation.ObservationControl.OnlineControl.Cobalt.Correlator.nrIntegrationsPerBlock']))
self.assertEqual(int, type(otdb_info['LOFAR.ObsSW.Observation.ObservationControl.OnlineControl.Cobalt.blockSize']))
@mock.patch('lofar.sas.resourceassignment.common.specification.logger') @mock.patch('lofar.sas.resourceassignment.common.specification.logger')
def test_onObservationApproved_log_mom_id_found(self, logger_mock): def test_onObservationApproved_log_mom_id_found(self, logger_mock):
...@@ -301,6 +308,21 @@ class PreschedulerTest(unittest.TestCase): ...@@ -301,6 +308,21 @@ class PreschedulerTest(unittest.TestCase):
self.assertEqual(int, type(cobalt_settings['nrBlocks'])) self.assertEqual(int, type(cobalt_settings['nrBlocks']))
self.assertEqual(int, type(cobalt_settings['nrSubBlocks'])) self.assertEqual(int, type(cobalt_settings['nrSubBlocks']))
def test_calculateCobaltSettingsAndConvertToOTDBsettings(self):
'''combination of test_CobaltOTDBsettings and test_calculateCobaltSettings
Make sure that the values are calculated and converted correctly'''
spec = Specification(self.otdbrpc_mock, self.momrpc_mock, self.radbrpc_mock)
spec.internal_dict = self.test_specification
otdb_info = cobaltOTDBsettings(calculateCobaltSettings(spec))
# beware! assertEqual succeeds for a comparison between 42.0 and 42
# but for lofar specs it is essential that some values are int
# so, check specifically for those!
self.assertEqual(otdb_info, self.otdb_info)
self.assertEqual(int, type(otdb_info['LOFAR.ObsSW.Observation.ObservationControl.OnlineControl.Cobalt.Correlator.nrBlocksPerIntegration']))
self.assertEqual(int, type(otdb_info['LOFAR.ObsSW.Observation.ObservationControl.OnlineControl.Cobalt.Correlator.nrIntegrationsPerBlock']))
self.assertEqual(int, type(otdb_info['LOFAR.ObsSW.Observation.ObservationControl.OnlineControl.Cobalt.blockSize']))
@mock.patch("lofar.common.util.waitForInterrupt") @mock.patch("lofar.common.util.waitForInterrupt")
@mock.patch("lofar.messaging.messagebus.BusListener.start_listening") @mock.patch("lofar.messaging.messagebus.BusListener.start_listening")
def test_main(self, mock_wait, mock_otdbbuslistener): def test_main(self, mock_wait, mock_otdbbuslistener):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment