File: PYMOL-2667.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 (31 lines) | stat: -rw-r--r-- 994 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
'''
PYMOL-2667
Atom-level unique ids PSE loading
'''

from pymol import cmd, CmdException, testing, stored

class TestPYMOL2667(testing.PyMOLTestCase):

    @testing.requires_version('1.7.6.7')
    def test2667(self):
        cmd.fragment('ala', 'm1')
        cmd.alter_state(1, '%m1', 's.label_placement_offset = [1., 0., 0.]')

        with testing.mktemp('.pse') as filename:
            cmd.save(filename)
            cmd.set_name('m1', 'm2')
            cmd.load(filename, partial=1)

        # now we have two copies (m1 m2). If unique ids are converted upon
        # loading, then there will be no settings cross-leaking. Otherwise
        # changing m1 settings will affect m2.

        cmd.alter_state(1, '%m1', 's.label_placement_offset = [0., 1., 0.]')

        m2_setting = []
        cmd.iterate_state(1,
                'first %m2', 'm2_setting.append(s.label_placement_offset)',
                space=locals())

        self.assertArrayEqual([1., 0., 0.], m2_setting[0], 0.001)