Commits

Kazuhiko Shimada authored a84d8c3cd77
CAS-13520: modified a scope of unexist_folder.

refs #2312
No tags

casatasks/tests/tasks/test_imbaseline.py

Modified
17 17 import (CasaImageStack, EraseableFolder, Image2MSMethods, Image2MSParams, ImageShape, ImageSubtractionMethods,
18 18 ImsmoothMethods, ImsmoothParams, MeasurementSetStack, MS2ImageMethods, SdbaselineMethods,
19 19 SdbaselineParams, SdsmoothMethods, SdsmoothParams, UnerasableFolder,
20 20 eraseable_folder_register, get_image_shape, imbaseline)
21 21
22 22 from casatools import ctsys, image, table
23 23
24 24 _tb = table()
25 25 ctsys_resolve = ctsys.resolve
26 26 DATACOLUMN = 'DATA'
27 +UNEXISTS = 'unexists'
27 28 casalog.origin('imbaseline')
28 29
29 30
30 31 class test_base(unittest.TestCase):
31 32
32 33 @staticmethod
33 34 def invalid_argument_case(func):
34 35 """Decorator for the test case that is intended to fail due to invalid argument."""
35 36 @functools.wraps(func)
36 37 def wrapper(self):
114 115 1-11. bottom() exist stuff
115 116 1-12. bottom() unexist stuff
116 117 1-13. clear() exist EraseableFolder file
117 118 1-14. clear() exist UneraseableFolder file
118 119 1-15. erase EraseableFolder file
119 120 1-16. erase UneraseableFolder file
120 121 """
121 122
122 123 dummy_folder1 = 'dummy1'
123 124 dummy_folder2 = 'dummy2'
124 - unexist_folder = 'unexists'
125 125
126 126 def setUp(self):
127 127 if os.path.exists(self.dummy_folder1):
128 128 shutil.rmtree(self.dummy_folder1)
129 129 os.mkdir(self.dummy_folder1)
130 130 if os.path.exists(self.dummy_folder2):
131 131 shutil.rmtree(self.dummy_folder2)
132 132 os.mkdir(self.dummy_folder2)
133 - if os.path.exists(self.unexist_folder):
134 - shutil.rmtree(self.unexist_folder)
133 + if os.path.exists(UNEXISTS):
134 + shutil.rmtree(UNEXISTS)
135 135
136 136 def test_1_1(self):
137 137 stack = CasaImageStack(UnerasableFolder(self.dummy_folder1))
138 138 self.assertTrue(stack.height() == 1)
139 139
140 - @test_base.exception_case(ValueError, 'file unexists is not found')
140 + @test_base.exception_case(ValueError, f'file {UNEXISTS} is not found')
141 141 def test_1_2(self):
142 - CasaImageStack(UnerasableFolder(self.unexist_folder))
142 + CasaImageStack(UnerasableFolder(UNEXISTS))
143 143
144 144 def test_1_3(self):
145 145 stack = CasaImageStack()
146 146 stack.push(UnerasableFolder(self.dummy_folder1))
147 147 self.assertTrue(stack.height() == 1)
148 148
149 - @test_base.exception_case(ValueError, 'file unexists is not found')
149 + @test_base.exception_case(ValueError, f'file {UNEXISTS} is not found')
150 150 def test_1_4(self):
151 151 stack = CasaImageStack()
152 - stack.push(UnerasableFolder(self.unexist_folder))
152 + stack.push(UnerasableFolder(UNEXISTS))
153 153
154 154 def test_1_5(self):
155 155 stack = CasaImageStack()
156 156 stack.push(UnerasableFolder(self.dummy_folder1))
157 157 obj = UnerasableFolder(self.dummy_folder2)
158 158 stack.push(obj)
159 159 tmp = stack.pop()
160 160 self.assertEqual(obj, tmp)
161 161 self.assertTrue(stack.height() == 1)
162 162
979 979 pa=pa,
980 980 blfunc=blfunc,
981 981 output_cont=output_cont,
982 982 bloutput=bloutput)
983 983 self.assertTrue(os.path.exists(bloutput))
984 984
985 985
986 986 def suite():
987 987 return [imsmooth_test, AbstractFileStack_test, ImageShape_test, imbaseline_test, image2ms_test, sdbaseline_test,
988 988 image_subtraction_test, misc_test]
989 -

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut