from __future__ import absolute_import
from casatasks.private.casa_transition import is_CASA6
from casatasks import plotants
from casatools import ctsys
ctsys_resolve = ctsys.resolve
from __main__ import default
def ctsys_resolve(apath):
dataPath = os.path.join(os.environ['CASAPATH'].split()[0],'casatestdata/')
return os.path.join(dataPath,apath)
Unit tests for task plotants. It tests the following parameters:
vis: wrong and correct values
figfile: if output is created
class plotants_test(unittest.TestCase):
if not is_CASA6: default(plotants)
if (not os.path.exists(self.msfile)):
datapath = ctsys_resolve('unittest/plotants/')
shutil.copytree(os.path.join(datapath,self.msfile), self.msfile)
if (os.path.exists(self.msfile)):
os.system('rm -rf ' + self.msfile)
os.system('rm -rf ' + self.fig)
'''Test 1: Default parameters'''
self.assertRaises(Exception,plotants)
self.assertFalse(self.res)
'''Test 2: Bad input file'''
self.assertRaises(Exception,plotants,vis=msfile)
self.res = plotants(vis=msfile)
self.assertFalse(self.res)