from __main__ import default
Unit tests for task oldhanningsmooth. It tests the following parameters:
vis: wrong and correct values
vis: check that output column is created
Other tests: check that theoretical and calculated values of column CORRECTED_DATA
class oldhanningsmooth_test(unittest.TestCase):
out = 'oldhanningsmooth_test'
default(oldhanningsmooth)
datapath = os.environ.get('CASAPATH').split()[0] + '/data/regression/unittest/hanningsmooth/'
shutil.copytree(datapath+self.msfile, self.msfile)
if (os.path.exists(self.msfile)):
os.system('rm -rf ' + self.msfile)
if (os.path.exists('cvelngc.ms')):
os.system('rm -rf cvelngc.ms')
if (os.path.exists(self.out)):
os.system('rm -rf ' + self.out)
shutil.rmtree('mynewms.ms',ignore_errors=True)
'''Test 0: Default values'''
self.res = oldhanningsmooth()
self.assertFalse(self.res)
"""Test 1: Wrong input MS should return False"""
self.res = oldhanningsmooth(vis=msfile)
self.assertFalse(self.res)
'''Test 2: Check that output column is created'''
self.res = oldhanningsmooth(vis=self.msfile, datacolumn='corrected')
self.assertEqual(self.res,None)
cd = th.getColDesc(self.msfile, 'CORRECTED_DATA')
'''Test 3: Theoretical and calculated values should be the same with datacolumn==CORRECTED'''
flag_col = th.getVarCol(self.msfile, 'FLAG')