mailr9428 - /1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on September 02, 2009 - 15:15:
Author: bugman
Date: Wed Sep  2 15:15:13 2009
New Revision: 9428

URL: http://svn.gna.org/viewcvs/relax?rev=9428&view=rev
Log:
Added a unit test checking the generic_fns.structure.__all__ list.


Added:
    1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py

Added: 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py?rev=9428&view=auto
==============================================================================
--- 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py (added)
+++ 1.3/test_suite/unit_tests/_generic_fns/_structure/test___init__.py Wed 
Sep  2 15:15:13 2009
@@ -1,0 +1,63 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2009 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax.                                    
 #
+#                                                                            
 #
+# relax is free software; you can redistribute it and/or modify              
 #
+# it under the terms of the GNU General Public License as published by       
 #
+# the Free Software Foundation; either version 2 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# relax is distributed in the hope that it will be useful,                   
 #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of             
 #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              
 #
+# GNU General Public License for more details.                               
 #
+#                                                                            
 #
+# You should have received a copy of the GNU General Public License          
 #
+# along with relax; if not, write to the Free Software                       
 #
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
 #
+#                                                                            
 #
+###############################################################################
+
+# Python module imports.
+from os import listdir, sep
+from re import search
+import sys
+from unittest import TestCase
+
+# relax module imports.
+from generic_fns import structure
+
+
+class Test___init__(TestCase):
+    """Unit tests for the data.Data class."""
+
+    def test___all__(self):
+        """Test if all package modules are located in the __all__ list."""
+
+        # Path to the files.
+        path = sys.path[0] + sep + 'generic_fns' + sep + 'structure'
+
+        print("The __all__ list: %s" % structure.__all__)
+
+        # Loop over all modules.
+        files = listdir(path)
+        for file in files:
+            # Only look at the '*.py' files.
+            if not search('.py$', file):
+                continue
+
+            # Skip __init__.py
+            if file == '__init__.py':
+                continue
+
+            # Remove the '.py' part.
+            module = file[:-3]
+
+            # Print out.
+            print("\nFile:   %s" % file)
+            print("Module: %s" % module)
+
+            # Check if the module is in __all__.
+            self.assert_(module in structure.__all__)




Related Messages


Powered by MHonArc, Updated Wed Sep 02 21:20:10 2009