Author: bugman
Date: Wed Jan 28 15:02:11 2015
New Revision: 27342

URL: http://svn.gna.org/viewcvs/relax?rev=27342&view=rev
Log:
Created the Test_coordinates.test_common_residues unit test.

This is from the _lib._structure._internal.test_coordinates unit test module.  
The test shows that
the lib.structure.internal.coordinates.common_residues() function is working 
correctly.  However the
printout, which is not caught by the test, is incorrect.


Modified:
    trunk/test_suite/unit_tests/_lib/_structure/_internal/test_coordinates.py

Modified: 
trunk/test_suite/unit_tests/_lib/_structure/_internal/test_coordinates.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/unit_tests/_lib/_structure/_internal/test_coordinates.py?rev=27342&r1=27341&r2=27342&view=diff
==============================================================================
--- trunk/test_suite/unit_tests/_lib/_structure/_internal/test_coordinates.py   
(original)
+++ trunk/test_suite/unit_tests/_lib/_structure/_internal/test_coordinates.py   
Wed Jan 28 15:02:11 2015
@@ -19,6 +19,9 @@
 #                                                                             #
 ###############################################################################
 
+# Python module imports.
+from numpy import array, int16
+
 # relax module imports.
 from lib.structure.internal import coordinates
 from test_suite.unit_tests.base_classes import UnitTestCase
@@ -27,4 +30,36 @@
 class Test_coordinates(UnitTestCase):
     """Unit tests for the functions of the 
'lib.structure.internal.coordinates' module."""
 
+    def test_common_residues(self):
+        """Test the lib.structure.internal.coordinates.common_residues() 
function."""
 
+        # The gap matrices.
+        gap_matrices = [
+            array([
+                [1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1],
+                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0]
+            ], int16),
+            array([
+                [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1],
+                [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+            ], int16)
+        ]
+        seq1 =     'TEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADG**'
+        seq2 = 
'ADQLTEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADGNGTIDFPEFLTMMARKM**'
+        seq3 =    
'LTEEQIAEFKEAFSLFDKDGDGTITTKELGTVMRSLGQNPTEAELQDMINEVDADGNGTIDFPEFLTMMAR**'
+
+        # Determine the common residues.
+        skip = coordinates.common_residues(gap_matrices=gap_matrices, 
one_letter_codes=[seq1, seq2, seq3])
+
+        # The expected skipping matrices.
+        N = len(seq1)
+        skip_real = [
+            [0]*N,
+            [1]*4 + [0]*N + [1]*(len(seq2)-N-4),
+            [1] + [0]*N + [1]*(len(seq3)-N-1)
+        ]
+
+        # Checks.
+        for i in range(3):
+            print("Sequence %i" % (i+1))
+            self.assertEqual(len(skip_real[i]), len(skip[i]))


_______________________________________________
relax (http://www.nmr-relax.com)

This is the relax-commits mailing list
[email protected]

To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits

Reply via email to