File: PYMOL-772.py

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (44 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'''
Regression test for PYMOL-772
partial load of PSE file duplicates groups with identical name 
'''

import unittest
from pymol import cmd, testing

class Test772(testing.PyMOLTestCase):

    v_ref = ['m1', 'm2', 'g1']

    def _load_session_twice(self):
        cmd.load('PYMOL-772-example.pse.gz', partial=1)
        cmd.load('PYMOL-772-example.pse.gz', partial=1)

    def testDoNotDuplicateGroup(self):
        cmd.pseudoatom('m3')
        cmd.group('g1', 'm3')
        cmd.load('PYMOL-772-example.pse.gz', partial=1)

        v = cmd.get_names()
        self.assertEqual(v, ['m3', 'g1', 'm1', 'm2'])

    @unittest.skip("alter not implemented yet")
    def testAppend(self):
        cmd.set('auto_rename_duplicate_objects', 0)

        self._load_session_twice()

        v = cmd.get_names()
        self.assertEqual(v, self.v_ref)
 
    def testRename(self):
        cmd.set('auto_rename_duplicate_objects', 1)

        self._load_session_twice()

        v = cmd.get_names()
        v_ref = self.v_ref + [n + '_2' for n in self.v_ref
                if not n.startswith('g')]
        self.assertEqual(v, v_ref)

# vi:nowrap