mailr18062 - in /branches/cst: ./ generic_fns/align_tensor.py test_suite/system_tests/align_tensor.py


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

Header


Content

Posted by edward on November 30, 2012 - 16:28:
Author: bugman
Date: Fri Nov 30 16:28:13 2012
New Revision: 18062

URL: http://svn.gna.org/viewcvs/relax?rev=18062&view=rev
Log:
Merged revisions 18060-18061 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r18060 | bugman | 2012-11-30 14:08:06 +0100 (Fri, 30 Nov 2012) | 3 lines
  
  Created the Align_tensor.test_copy system test to catch bug #20338 
(https://gna.org/bugs/?20338).
........
  r18061 | bugman | 2012-11-30 14:18:12 +0100 (Fri, 30 Nov 2012) | 3 lines
  
  Fix for bug #20338 (https://gna.org/bugs/?20338), the new tensor name is 
now set.
........

Modified:
    branches/cst/   (props changed)
    branches/cst/generic_fns/align_tensor.py
    branches/cst/test_suite/system_tests/align_tensor.py

Propchange: branches/cst/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Nov 30 16:28:13 2012
@@ -1,1 +1,1 @@
-/trunk:1-18055
+/trunk:1-18061

Modified: branches/cst/generic_fns/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/cst/generic_fns/align_tensor.py?rev=18062&r1=18061&r2=18062&view=diff
==============================================================================
--- branches/cst/generic_fns/align_tensor.py (original)
+++ branches/cst/generic_fns/align_tensor.py Fri Nov 30 16:28:13 2012
@@ -113,13 +113,11 @@
 
     @param tensor_from: The identification string of the alignment tensor to 
copy the data from.
     @type tensor_from:  str
-    @param pipe_from:   The data pipe to copy the alignment tensor data 
from.  This defaults to the
-                        current data pipe.
+    @param pipe_from:   The data pipe to copy the alignment tensor data 
from.  This defaults to the current data pipe.
     @type pipe_from:    str
     @param tensor_to:   The identification string of the alignment tensor to 
copy the data to.
     @type tensor_to:    str
-    @param pipe_to:     The data pipe to copy the alignment tensor data to.  
This defaults to the
-                        current data pipe.
+    @param pipe_to:     The data pipe to copy the alignment tensor data to.  
This defaults to the current data pipe.
     @type pipe_to:      str
     """
 
@@ -158,8 +156,12 @@
     # Copy the data.
     if index_to == None:
         
dp_to.align_tensors.append(deepcopy(dp_from.align_tensors[index_from]))
+        index_to = len(dp_to.align_tensors) - 1
     else:
         dp_to.align_tensors[index_to] = 
deepcopy(dp_from.align_tensors[index_from])
+
+    # Update the tensor's name.
+    dp_to.align_tensors[index_to].set('name', tensor_to)
 
 
 def data_names():

Modified: branches/cst/test_suite/system_tests/align_tensor.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/cst/test_suite/system_tests/align_tensor.py?rev=18062&r1=18061&r2=18062&view=diff
==============================================================================
--- branches/cst/test_suite/system_tests/align_tensor.py (original)
+++ branches/cst/test_suite/system_tests/align_tensor.py Fri Nov 30 16:28:13 
2012
@@ -83,6 +83,27 @@
         cdp.align_tensors[2].set(param='Axx', value=1)
 
 
+    def test_copy(self):
+        """Test the copying of alignment tensors (to catch bug #20338, 
https://gna.org/bugs/?20338)."""
+
+        # First reset.
+        self.interpreter.reset()
+
+        # Create a data pipe.
+        self.interpreter.pipe.create('copy test', 'N-state')
+
+        # Initialise one tensor.
+        self.interpreter.align_tensor.init(tensor='orig', 
params=self.tensors_full[0], param_types=0)
+
+        # Copy the tensor.
+        self.interpreter.align_tensor.copy(tensor_from='orig', 
tensor_to='new')
+
+        # Checks.
+        self.assertEqual(len(cdp.align_tensors), 2)
+        self.assertEqual(cdp.align_tensors[0].name, 'orig')
+        self.assertEqual(cdp.align_tensors[1].name, 'new')
+
+
     def test_to_and_from_xml(self):
         """Test the conversion to and from XML."""
 




Related Messages


Powered by MHonArc, Updated Fri Nov 30 16:40:02 2012