File: check-db-entries.py

package info (click to toggle)
python-ihm 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,368 kB
  • sloc: python: 30,422; ansic: 5,990; sh: 24; makefile: 20
file content (51 lines) | stat: -rw-r--r-- 1,475 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
45
46
47
48
49
50
51
import unittest
import ihm.reader
import ihm.dumper
import urllib.request
import os


class Tests(unittest.TestCase):
    def _read_cif(self, pdb_id):
        url = 'https://pdb-ihm.org/cif/%s.cif' % pdb_id
        with urllib.request.urlopen(url) as fh:
            s, = ihm.reader.read(fh)
        return s

    def _write_cif(self, s, check=True):
        with open('test.cif', 'w') as fh:
            ihm.dumper.write(fh, [s], check=check)
        os.unlink('test.cif')

    def test_9a0e(self):
        """Test IMP structure without errors (9a0e)"""
        s = self._read_cif('9a0e')
        # This used to have an incorrect reference sequence, now fixed.
        self._write_cif(s)

    def test_8zzd(self):
        """Test docking structure without errors (8zzd)"""
        s = self._read_cif('8zzd')
        # This used to have an incorrect assembly, now fixed.
        self._write_cif(s)

    def test_9a82(self):
        """Test HADDOCK structure without errors (9a82)"""
        s = self._read_cif('9a82')
        self._write_cif(s)

    def test_9a13(self):
        """Test HADDOCK structure without errors (9a13)"""
        s = self._read_cif('9a13')
        # This used to fail because feature #71 was null, but this
        # is now fixed.
        self._write_cif(s)

    def test_9a0t(self):
        """Test IMP structure without errors (9a0t)"""
        s = self._read_cif('9a0t')
        self._write_cif(s)


if __name__ == '__main__':
    unittest.main()