File: test_structure.py

package info (click to toggle)
python-cogent 1.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 16,424 kB
  • ctags: 24,343
  • sloc: python: 134,200; makefile: 100; ansic: 17; sh: 10
file content (34 lines) | stat: -rwxr-xr-x 1,216 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
#!/usr/bin/env python
"""Unit tests for the pdb parser.
"""
from cogent.util.unit_test import TestCase, main
from cogent.core.entity import Structure
from cogent.parse.structure import FromFilenameStructureParser, FromFileStructureParser

__author__ = "Marcin Knight"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__ = ["Marcin Cieslik"]
__license__ = "GPL"
__version__ = "1.5.3"
__maintainer__ = "Marcin Cieslik"
__email__ = "mpc4p@virginia.edu"
__status__ = "Production"


class structuresTests(TestCase):
    """Tests of cogent.parse.structure UI functions."""
    
    def test_FromFilenameStructureParser(self):
        structure = FromFilenameStructureParser('data/1LJO.pdb', 'pdb')
        self.assertRaises(TypeError, FromFilenameStructureParser, open('data/1LJO.pdb'), 'pdb')
        assert isinstance(structure, Structure)
    
    def test_FromFileStructureParser(self):
        structure = FromFileStructureParser(open('data/1LJO.pdb'), 'pdb')
        assert isinstance(structure, Structure)
        self.assertRaises(TypeError, FromFileStructureParser, 'data/1LJO.pdb', 'pdb')
        assert isinstance(structure, Structure)         
    
    
if __name__ == '__main__':
    main()