Exemple #1
0
    def setUp(self):
        self.handler = self.cls()

        test(self.cls)
        test(self.cls.__init__)
        try:
            notest(self.cls.is_file_valid)
        except AttributeError:
            pass
Exemple #2
0
    python -m unittest [-v] config_test
"""
import syntax_check
from syntax_check import notest, testing, randomword, expando
import unittest

import random

import pydesc.config as config

syntax_check.module = config

TestSyntax = syntax_check.module_syntax()

notest(config.ConfigManager.show_config)

# pylint: disable=C0111


class BasicTests(unittest.TestCase):
    @testing(config.Param)
    @testing(config.Param.__init__)
    def test_param_init(self):
        name = randomword(8)
        val = expando()

        par = config.Param(name, val)

        self.assertEqual((name, val, None),
                         (par.name, par.value, par.default_value))
Exemple #3
0
from syntax_check import notest, testing

import Bio.PDB

import warnings

import pydesc.structure as structure
import pydesc.numberconverter as numberconverter
import pydesc.geometry as geometry
import pydesc.cydesc as cydesc
import pydesc.cydesc.overfit as overfit
import tests

syntax_check.module = overfit

notest(overfit.c_float_4)
notest(overfit.Overfit.token_context)

data_dir = tests.__path__[0] + '/data/test_structures/'

skip_slow = False
fast = False

TestSyntax = syntax_check.module_syntax()

# pylint: disable=C0111, R0201, R0912


def assert_sums_equal(self, sums1, sums2):
    for field_name, field_type in overfit.t_overfit_sums._fields_:
        if field_type is overfit.c_float_4:
Exemple #4
0
test(contacts.DihedralAngleCriterion.is_in_contact)
test(contacts.HorizontalBisectorDistanceCriterion)
test(contacts.HorizontalBisectorDistanceCriterion.__init__)
test(contacts.HorizontalBisectorDistanceCriterion.is_in_contact)
test(contacts.PointsDistanceCriterion)
test(contacts.PointsDistanceCriterion.__init__)
test(contacts.SetDistanceCriterion)
test(contacts.SetDistanceCriterion.__init__)
test(contacts.SetDistanceCriterion.is_in_contact)
test(contacts.VerticalBisectorDistanceCriterion)
test(contacts.VerticalBisectorDistanceCriterion.__init__)
test(contacts.VerticalBisectorDistanceCriterion.is_in_contact)
test(contacts.CombinedContact)
test(contacts.CombinedContact.__init__)

notest(contacts.ContactsExclusiveDisjunction)

#~ notest(contacts.ContactMap)

data_dir = tests.__path__[0] + '/data/test_structures/'

# pylint: disable=C0111,R0912


def make_contactbasictest(strname, crit_cls):
    """Create and return a ContactBasicTest testcase for a given structure and contact criterion. """
    @testing(crit_cls)
    @test_name_append(crit_cls, strname)
    class ContactBasicTest(unittest.TestCase):
        name = strname
Exemple #5
0
from syntax_check import notest, test
import unittest

import os
import itertools
from collections import defaultdict

import pydesc.dbhandler as dbhandler
from pydesc.config import ConfigManager
import tests

syntax_check.module = dbhandler

TestSyntax = syntax_check.module_syntax()

notest(dbhandler.add_db_dir)
notest(dbhandler.validate_id)
notest(dbhandler.InvalidID)
notest(dbhandler.DBHandler)

data_dir = tests.__path__[0] + '/data/dbtest/'

fast = False

fast = True

# pylint: disable=C0111


class HandlerTestMixin(object):
Exemple #6
0
import Bio.PDB

import warnings

import pydesc.selection as selection
import pydesc.structure as structure
import pydesc.numberconverter as numberconverter
import tests

import operator
#TO

syntax_check.module = selection

notest(selection.Selection)

fast = False

#~ fast = True

TestSyntax = syntax_check.module_syntax()

notest(selection.Selection.distinguish_chains)

# pylint: disable=C0111,R0912

random_generators = {}

data_dir = tests.__path__[0] + '/data/test_structures/'
Exemple #7
0
ConfigManager.warnings_and_exceptions.class_filters.set(
    "MonomerCreationFailed", "always")
ConfigManager.warnings_and_exceptions.class_filters.set(
    "NoConfiguration", "always")
ConfigManager.warnings_and_exceptions.class_filters.set(
    "UnknownParticleName", "always")
ConfigManager.warnings_and_exceptions.class_filters.set(
    "UserWarning", "always")
ConfigManager.warnings_and_exceptions.class_filters.set(
    "WrongMonomerType", "always")

syntax_check.module = warnexcept

TestSyntax = syntax_check.module_syntax()

notest(warnexcept.DiscontinuityError)
notest(warnexcept.IncompleteParticle)
notest(warnexcept.WrongAtomDistances)
notest(warnexcept.WrongMonomerType)
notest(warnexcept.CannotCalculateContact)


@testing(warnexcept.WarnManager)
class WarnManagerTest(unittest.TestCase):
    @testing(warnexcept.WarnManager.__init__)
    @classmethod
    def setUpClass(cls):
        cls.wm = warnexcept.WarnManager('obj_1')

    @testing(warnexcept.WarnManager.__enter__)
    @testing(warnexcept.WarnManager.__exit__)
Exemple #8
0
config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "NoConfiguration", "ignore")
config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "LocalCopyAccess", "ignore")
config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "Info", "ignore")
config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "UnknownParticleName", "ignore")
config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "IncompleteChainableParticle", "ignore")

warnexcept.set_filters()

syntax_check.module = structure

notest(structure.AbstractStructure.rotate)
notest(structure.AbstractStructure.translate)
notest(structure.AbstractStructure.monomers)

notest(structure.Chain)

notest(structure.Contact.get_other_element)

notest(structure.AbstractDescriptor.create_coord_vector)
notest(structure.AbstractDescriptor.create_descriptors)

data_dir = tests.__path__[0] + '/data/test_structures/'
dcd_data_dir = tests.__path__[0] + '/data/dcd/'

skip_slow = False
fast = False
Exemple #9
0
from pydesc.warnexcept import IncompleteChainableParticle as IncompleteChainableParticle

config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "UnknownParticleName", "ignore")
config.ConfigManager.warnings_and_exceptions.class_filters.set(
    "IncompleteChainableParticle", "ignore")

fast = False

fast = True

syntax_check.module = monomer

TestSyntax = syntax_check.module_syntax()

notest(monomer.Atom.__iter__)
#notest(monomer.Atom.__getattr__)
#notest(monomer.Atom.__setattr__)

notest(monomer.Monomer.get_pdb_id)
notest(monomer.MonomerChainable.next_monomer)
notest(monomer.MonomerChainable.previous_monomer)
notest(monomer.Monomer.is_next)
notest(monomer.Monomer.is_prev)
notest(monomer.Monomer.get_representation)

notest(monomer.MonomerChainable.__metaclass__)
notest(monomer.MonomerChainable.__metaclass__.__call__)

notest(monomer.MonomerOther.__metaclass__)
notest(monomer.MonomerOther.__metaclass__.__call__)