mailr25374 - in /trunk/test_suite/unit_tests/_lib: __init__.py test_periodic_table.py


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

Header


Content

Posted by edward on August 28, 2014 - 11:24:
Author: bugman
Date: Thu Aug 28 11:24:49 2014
New Revision: 25374

URL: http://svn.gna.org/viewcvs/relax?rev=25374&view=rev
Log:
Created the unit test infrastructure for the lib.periodic_table module.

This includes one unit test of the 
lib.periodic_table.periodic_table.atomic_weight() function which
has not been implemented yet.


Added:
    trunk/test_suite/unit_tests/_lib/test_periodic_table.py
Modified:
    trunk/test_suite/unit_tests/_lib/__init__.py

Modified: trunk/test_suite/unit_tests/_lib/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/__init__.py?rev=25374&r1=25373&r2=25374&view=diff
==============================================================================
--- trunk/test_suite/unit_tests/_lib/__init__.py        (original)
+++ trunk/test_suite/unit_tests/_lib/__init__.py        Thu Aug 28 11:24:49 
2014
@@ -1,6 +1,6 @@
 
###############################################################################
 #                                                                            
 #
-# Copyright (C) 2013 Edward d'Auvergne                                       
 #
+# Copyright (C) 2013-2014 Edward d'Auvergne                                  
 #
 #                                                                            
 #
 # This file is part of the program relax (http://www.nmr-relax.com).         
 #
 #                                                                            
 #
@@ -38,6 +38,7 @@
     'test_float',
     'test_io',
     'test_mathematics',
+    'test_periodic_table',
     'test_regex',
     'test_selection'
 ]

Added: trunk/test_suite/unit_tests/_lib/test_periodic_table.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/test_periodic_table.py?rev=25374&view=auto
==============================================================================
--- trunk/test_suite/unit_tests/_lib/test_periodic_table.py     (added)
+++ trunk/test_suite/unit_tests/_lib/test_periodic_table.py     Thu Aug 28 
11:24:49 2014
@@ -0,0 +1,42 @@
+###############################################################################
+#                                                                            
 #
+# Copyright (C) 2014 Edward d'Auvergne                                       
 #
+#                                                                            
 #
+# This file is part of the program relax (http://www.nmr-relax.com).         
 #
+#                                                                            
 #
+# This program 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 3 of the License, or          
 #
+# (at your option) any later version.                                        
 #
+#                                                                            
 #
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.      
 #
+#                                                                            
 #
+###############################################################################
+
+# Python module imports.
+from unittest import TestCase
+
+# relax module imports.
+from lib.periodic_table import periodic_table
+
+
+class Test_periodic_table(TestCase):
+    """Unit tests for the lib.periodic_table module."""
+
+
+    def test_get_atomic_weight(self):
+        """Test of the periodic_table.atomic_weight() method."""
+
+        # Check the proton weight.
+        weight = periodic_table.atomic_weight(symbol='H')
+        self.assertEqual(weight, 1.007975)
+
+        # Check the helium weight.
+        weight = periodic_table.atomic_weight(symbol='He')
+        self.assertEqual(weight, 4.002602)




Related Messages


Powered by MHonArc, Updated Thu Aug 28 11:40:02 2014