Author: bugman
Date: Thu Oct 23 14:27:05 2014
New Revision: 26380

URL: http://svn.gna.org/viewcvs/relax?rev=26380&view=rev
Log:
Created the Structure.test_bug_22861_PDB_writing_chainID_fail system test.

This is to catch bug #22861 (https://gna.org/bugs/?22861), the chain IDs in the 
structure.write_pdb
user function PDB files are incorrect after calling structure.delete.


Modified:
    trunk/test_suite/system_tests/structure.py

Modified: trunk/test_suite/system_tests/structure.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/test_suite/system_tests/structure.py?rev=26380&r1=26379&r2=26380&view=diff
==============================================================================
--- trunk/test_suite/system_tests/structure.py  (original)
+++ trunk/test_suite/system_tests/structure.py  Thu Oct 23 14:27:05 2014
@@ -377,6 +377,36 @@
 
         # CoM.
         self.assertRaises(RelaxNoPdbError, self.interpreter.structure.com)
+
+
+    def test_bug_22861_PDB_writing_chainID_fail(self):
+        """Catch U{bug #22861<https://gna.org/bugs/?22861>}, the chain IDs in 
the structure.write_pdb user function PDB files are incorrect after calling 
structure.delete."""
+
+        # Add one atom to two different molecules.
+        self.interpreter.structure.add_atom(mol_name='A', atom_name='N', 
res_name='Phe', res_num=1, pos=[1.0, 1.0, 1.0], element='N')
+        self.interpreter.structure.add_atom(mol_name='B', atom_name='N', 
res_name='Phe', res_num=1, pos=[1.0, 1.0, 1.0], element='N')
+
+        # Delete the first molecule.
+        self.interpreter.structure.delete('#A')
+
+        # Create a PDB file.
+        file = DummyFileObject()
+        self.interpreter.structure.write_pdb(file=file, force=True)
+
+        # The file contents, without remarks, as they should be.
+        contents = [
+            "ATOM      1  N   Phe A   1       1.000   1.000   1.000  1.00  
0.00           N  \n",
+            "TER       2      Phe A   1                                        
              \n",
+            "MASTER        0    0    0    0    0    0    0    0    1    1    0 
   0          \n",
+            "END                                                               
              \n"
+        ]
+
+        # Check the created PDB file.
+        lines = file.readlines()
+        self.strip_remarks(lines)
+        self.assertEqual(len(contents), len(lines))
+        for i in range(len(lines)):
+            self.assertEqual(contents[i], lines[i])
 
 
     def test_collapse_ensemble(self):


_______________________________________________
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