File: PYMOL-317.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 (39 lines) | stat: -rw-r--r-- 1,198 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
'''
PYMOL-317
can't select by atom type
'''

import os
from pymol import cmd, testing, stored
import unittest

@testing.requires('mmlibs')
@testing.requires('incentive')
@testing.requires('no_edu')
class TestPYMOL317(testing.PyMOLTestCase):

    def _testLabelByAtomType(self):
        cmd.load(self.datafile('1oky.pdb.gz'))
        cmd.remove("alt 'B'")
        cmd.label('resn STU', 'text_type')
        c3labels = []
        cmd.iterate("resn STU", "c3labels.append(label == 'C.3')", space=locals())
        self.assertEquals(sum(c3labels), 8)

    def testSelectByAtomType(self):
        cmd.load(self.datafile('1oky.pdb.gz'))
        cmd.remove("alt 'B'")
        cmd.select('foo', "resn STU and text_type 'C.3'")
        self.assertEquals(cmd.count_atoms('foo'), 8)

        # discrete object
        cmd.delete('*')
        cmd.load(self.datafile('ligs3d.sdf'))
        self.assertTrue(cmd.count_discrete('*') > 0)
        n = cmd.select('foo', "text_type 'C.3'")
        self.assertEquals(n, 115)

        # only run label test if selection tests passed. Don't wnat
        # more than one failing tests for builds with NO_MMLIBS
        cmd.delete('*')
        self._testLabelByAtomType()