Commit 90573cc9b28378caf3fbc4fb9a6a006145f73c05

Authored by Jürgen Knödlseder
1 parent 5ccf8077

Add unit test on empty csiactobs.py script

Showing 1 changed file with 26 additions and 0 deletions
test/test_csiactobs.py
... ... @@ -129,6 +129,32 @@ class Test(test):
129 129 """
130 130 Test csiactobs from Python
131 131 """
  132 + # Allocate empty csiactobs script
  133 + iactobs = cscripts.csiactobs()
  134 +
  135 + # Check that empty csiactobs sciript has an empty observation container
  136 + # and energy boundaries
  137 + self.test_value(iactobs.obs().size(), 0,
  138 + 'Check that empty csiactobs has an empty observation container')
  139 + self.test_value(iactobs.ebounds().size(), 0,
  140 + 'Check that empty csiactobs has empty energy bins')
  141 +
  142 + # Check that saving saves an empty model definition file
  143 + iactobs['outobs'] = 'csiactobs_obs_py0.xml'
  144 + iactobs['outmodel'] = 'csiactobs_bgd_py0.xml'
  145 + iactobs['logfile'] = 'csiactobs_py0.log'
  146 + iactobs.logFileOpen()
  147 + iactobs.save()
  148 +
  149 + # Check empty observation definition XML file
  150 + #self._check_obsdef('csiactobs_obs_py0.xml', 0) # See #1841
  151 +
  152 + # Check empty model definition XML file
  153 + self._check_moddef('csiactobs_bgd_py0.xml', 0)
  154 +
  155 + # Check that clearing does not lead to an exception or segfault
  156 + #iactobs.clear()
  157 +
132 158 # Set-up csiactobs
133 159 iactobs = cscripts.csiactobs()
134 160 iactobs['datapath'] = self._datapath
... ...