Exemple #1
0
import utils
import os
import unittest

TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
utils.set_search_paths(TOPDIR)
import ihm.dataset
import ihm.location


def _make_test_file(fname):
    with open(fname, 'w') as fh:
        fh.write('contents')


class Tests(unittest.TestCase):
    def test_dataset(self):
        """Test Dataset base class"""
        l = ihm.location.PDBLocation('1abc', version='foo', details='bar')
        d = ihm.dataset.Dataset(l)
        self.assertIsNone(d.details)
        self.assertEqual(len(d.parents), 0)

        l2 = ihm.location.PDBLocation('1xyz', version='foo', details='bar')
        d2 = ihm.dataset.Dataset(l2, details='foo')
        self.assertEqual(d2.details, 'foo')
        d.parents.append(d2)
        self.assertEqual(len(d.parents), 1)
        self.assertNotEqual(d, d2)

    def test_add_primary_no_parents(self):
Exemple #2
0
import utils

utils.set_search_paths(__file__)
import results


def test_summary():
    """Test the summary page"""
    c = results.app.test_client()
    _ = c.get('/')
import unittest
import os
import sys
if sys.version_info[0] >= 3:
    from io import StringIO
else:
    from io import BytesIO as StringIO
import utils
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
utils.set_search_paths(TOPDIR)

import allosmod.util.align

TEST_ALIGNMENT = """
C; test alignment

>P1;pm.pdb
sequence:pm.pdb:  ::::::-1.00:-1.00
N/T--TVFQGVAGQSLQ*

>P1;TREMcopy.pdb
structureX:TREMcopy.pdb:  20 :A:+112 :A:::-1.00:-1.00
NT-TV/F-QGVAGQSLQ*
"""

class Tests(unittest.TestCase):
    def test_insert(self):
        """Test align.insert_gap()"""
        with utils.temporary_directory() as tmpdir:
            ali = os.path.join(tmpdir, 'test_insert.ali')
            with open(ali, 'w') as fh:
import unittest
import modeller
import os
import sys
import subprocess
import collections
import utils
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
test_dir = utils.set_search_paths(TOPDIR)

from allosmod.util import check_output

class Tests(unittest.TestCase):
    def test_bad(self):
        """Test wrong arguments to get_q_ca"""
        out = check_output(['allosmod', 'get_q_ca'],
                           stderr=subprocess.STDOUT, retcode=2)
        out = check_output(['python', '-m',
                            'allosmod.get_q_ca'],
                           stderr=subprocess.STDOUT, retcode=2)

    def test_simple(self):
        """Simple complete run of get_q_ca"""
        out = check_output(['allosmod', 'get_q_ca',
                           os.path.join(test_dir, 'input',
                                        'test_qiavg.pdb'), '11.0',
                           os.path.join(test_dir, 'input',
                                        'test_qiavg_1.pdb'),
                           os.path.join(test_dir, 'input',
                                        'test_qiavg_2.pdb')])
        with open('qscore1to9.dat') as fh: