File: ChemCompReaderTests.py

package info (click to toggle)
librcsb-core-wrapper 1.005-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,576 kB
  • sloc: xml: 122,915; cpp: 25,250; ansic: 3,736; makefile: 1,033; sh: 772; lex: 294; yacc: 235; perl: 213; python: 121; csh: 30
file content (68 lines) | stat: -rw-r--r-- 2,089 bytes parent folder | download | duplicates (6)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
##
#
# File:    ChemCompReaderTests.py
# Author:  J. Westbrook
# Date:    13-Jan-2012
# Version: 0.001
##
"""
Test cases for reading and updating chemical component dictionary using Python CorePyWrap
wrapper module to C++ CifFile class library of file and dictionary tools.

"""
__docformat__ = "restructuredtext en"
__author__    = "John Westbrook"
__email__     = "jwest@rcsb.rutgers.edu"
__license__   = "Creative Commons Attribution 3.0 Unported"
__version__   = "V0.01"

import sys, unittest, traceback, filecmp
import sys, time, os, os.path, shutil

from CorePyWrap import ParseCif

class ChemCompReaderTests(unittest.TestCase):
    
    def setUp(self):
        self.__lfh=sys.stdout
        self.__verbose=True
        self.__pathPdbxDataFile       = "../data/1kip.cif"
        self.__pathBigPdbxDataFile    = "../data/2j01.cif"
        self.__pathChemCompDictFile   = "/data/components/cc-dict/Components-all-v3.cif"
        self.__pathPdbxDictFile       = "../data/mmcif_pdbx_v40.dic"
        self.__pathOutputPdbxFile     = "myPdbxOutputFile.cif"
        self.__pathBigOutputPdbxFile  = "myBigPdbxOutputFile.cif"        

    def tearDown(self):
        pass


    def testChemCompIndexDictionary(self): 
        """Test case -  read chemical dictionary and create index
        """
        self.__lfh.write("\nStarting %s %s\n" % (self.__class__.__name__,
                                               sys._getframe().f_code.co_name))
        try:
            myReader=ParseCif(self.__pathChemCompDictFile)
            #self.__lfh.write("Persistent index dictionary %r\n" % indexD.items())
        except:
            traceback.print_exc(file=self.__lfh)
            self.fail()

def suite():
    return unittest.makeSuite(ChemCompReaderTests,'test')


def suiteChemComp():
    suiteSelect = unittest.TestSuite()
    suiteSelect.addTest(ChemCompReaderTests("testChemCompIndexDictionary"))
    return suiteSelect

if __name__ == '__main__':
    # Run all tests -- 
    # unittest.main()
    #
    mySuite=suiteChemComp()
    unittest.TextTestRunner(verbosity=2).run(mySuite)