casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
test_componentlist.py
Go to the documentation of this file.
00001 ##########################################################################
00002 # imfit_test.py
00003 #
00004 # Copyright (C) 2008, 2009
00005 # Associated Universities, Inc. Washington DC, USA.
00006 #
00007 # This script is free software; you can redistribute it and/or modify it
00008 # under the terms of the GNU Library General Public License as published by
00009 # the Free Software Foundation; either version 2 of the License, or (at your
00010 # option) any later version.
00011 #
00012 # This library is distributed in the hope that it will be useful, but WITHOUT
00013 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015 # License for more details.
00016 #
00017 # You should have received a copy of the GNU Library General Public License
00018 # along with this library; if not, write to the Free Software Foundation,
00019 # Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00020 #
00021 # Correspondence concerning AIPS++ should be adressed as follows:
00022 #        Internet email: aips2-request@nrao.edu.
00023 #        Postal address: AIPS++ Project Office
00024 #                        National Radio Astronomy Observatory
00025 #                        520 Edgemont Road
00026 #                        Charlottesville, VA 22903-2475 USA
00027 #
00028 # <author>
00029 # Dave Mehringer
00030 # </author>
00031 #
00032 # <summary>
00033 # Test suite for the CASA imfit Task
00034 # </summary>
00035 #
00036 # <reviewed reviwer="" date="" tests="" demos="">
00037 # </reviewed
00038 #
00039 # <prerequisite>
00040 # <ul>
00041 #   <li> <linkto class="imfit.py:description">imfit</linkto> 
00042 # </ul>
00043 # </prerequisite>
00044 #
00045 # <etymology>
00046 # imfit_test stands for imfit test
00047 # </etymology>
00048 #
00049 # <synopsis>
00050 # imfit_test.py is a Python script that tests the correctness
00051 # of the ia.fitcomponents tool method and the imfit task in CASA.
00052 # </synopsis> 
00053 #
00054 # <example>
00055 # # This test was designed to run in the automated CASA test system.
00056 # # This example shows who to run it manually from within casapy.
00057 # casapy -c runUnitTest test_imcontsub
00058 #
00059 # or
00060 #
00061 # # This example shows who to run it manually from with casapy.
00062 # runUnitTest.main(['imcontsub_test'])
00063 #
00064 # </example>
00065 #
00066 # <motivation>
00067 # To provide a test standard to the imfit task to ensure
00068 # coding changes do not break the associated bits 
00069 # </motivation>
00070 #
00071 
00072 ###########################################################################
00073 import casac
00074 from tasks import *
00075 from taskinit import *
00076 from __main__ import *
00077 import unittest
00078 
00079 class componentlist_test(unittest.TestCase):
00080     
00081     def setUp(self):
00082         return
00083 
00084     def tearDown(self):
00085         return
00086  
00087     def test_summarize(self):
00088         """Test the cl.summarize() method"""
00089         # make me a list
00090         cl.addcomponent(
00091             [1,0,0,0],'Jy','Stokes',['J2000', '10:30:00.00', '-20.00.00.0'],
00092             'gaussian','4arcsec','2arcsec','30deg'
00093         )
00094         self.assertTrue(cl.summarize(0))
00095         self.assertRaises(Exception, cl.summarize, 1)
00096 
00097 
00098  
00099 
00100 def suite():
00101     return [componentlist_test]