mailr3492 - /1.3/test_suite/unit_tests/generic_fns/test_spin.py


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

Header


Content

Posted by edward on November 11, 2007 - 20:35:
Author: bugman
Date: Sun Nov 11 20:35:30 2007
New Revision: 3492

URL: http://svn.gna.org/viewcvs/relax?rev=3492&view=rev
Log:
Wrote 2 unit tests for the generic_fns.spin.create() function.

One tests that the function works correctly, the second that it fails 
correctly.


Modified:
    1.3/test_suite/unit_tests/generic_fns/test_spin.py

Modified: 1.3/test_suite/unit_tests/generic_fns/test_spin.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/test_suite/unit_tests/generic_fns/test_spin.py?rev=3492&r1=3491&r2=3492&view=diff
==============================================================================
--- 1.3/test_suite/unit_tests/generic_fns/test_spin.py (original)
+++ 1.3/test_suite/unit_tests/generic_fns/test_spin.py Sun Nov 11 20:35:30 
2007
@@ -237,3 +237,39 @@
         # Copy a spin to a number which already exists.
         self.assertRaises(RelaxError, spin.copy, spin_from=':1', 
spin_to=':2@78')
 
+
+    def test_creation(self):
+        """Test the creation of a spin.
+
+        The function used is generic_fns.spin.create().
+        """
+
+        # Create a few new spins.
+        spin.create(1, 'C3')
+        spin.create(2, 'C17')
+        spin.create(-3, 'N7')
+
+        # Test that the spin numbers are correct.
+        self.assertEqual(relax_data_store['orig'].mol[0].res[0].spin[0].num, 
1)
+        self.assertEqual(relax_data_store['orig'].mol[0].res[0].spin[1].num, 
2)
+        self.assertEqual(relax_data_store['orig'].mol[0].res[0].spin[2].num, 
-3)
+
+        # Test that the spin names are correct.
+        
self.assertEqual(relax_data_store['orig'].mol[0].res[0].spin[0].name, 'C3')
+        
self.assertEqual(relax_data_store['orig'].mol[0].res[0].spin[1].name, 'C17')
+        
self.assertEqual(relax_data_store['orig'].mol[0].res[0].spin[2].name, 'N7')
+
+
+    def test_creation_fail(self):
+        """Test the failure of spin creation (by supplying two spins with 
the same number).
+
+        The function used is generic_fns.spin.create().
+        """
+
+        # Create the first spin.
+        spin.create(1, 'P1')
+
+        # Assert that a RelaxError occurs when the next added spin has the 
same number as the first.
+        self.assertRaises(RelaxError, spin.create, 1, 'P3')
+
+




Related Messages


Powered by MHonArc, Updated Sun Nov 11 21:00:16 2007