IMP logo
IMP Reference Guide  develop.63b38c487d,2024/12/21
The Integrative Modeling Platform
IMP::test Namespace Reference

Support for running tests of IMP functionality. More...

Detailed Description

Support for running tests of IMP functionality.

Methods and classes for testing the IMP kernel and modules.

Most of this is centered around the Python unittest module.

Info

Author(s): Ben Webb, Daniel Russel

Maintainer: benmwebb

License: LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Publications:

Classes

class  ApplicationTestCase
 Super class for simple IMP application test cases. More...
 
class  DirectorObjectChecker
 Check to make sure the number of director references is as expected. More...
 
class  RefCountChecker
 Check to make sure the number of C++ object references is as expected. More...
 
class  TestCase
 Super class for IMP test cases. More...
 

Functions

def get_data_path
 Return the full path to one of this module's data files. More...
 
def get_example_path
 Return the full path to one of this module's example files. More...
 
def get_module_name
 Return the fully-qualified name of this module. More...
 
def get_module_version
 Return the version of this module, as a string. More...
 
def main
 Run a set of tests; similar to unittest.main(). More...
 
def numerical_derivative
 Calculate the derivative of the single-value function func at point val. More...
 
def temporary_directory
 Simple context manager to make a temporary directory. More...
 
def temporary_working_directory
 Simple context manager to run in a temporary directory. More...
 
def xyz_numerical_derivatives
 Calculate the x,y and z derivatives of the scoring function sf on the xyz particle. More...
 

Function Documentation

def IMP.test.get_data_path (   fname)

Return the full path to one of this module's data files.

Note
This function is only available in Python.

Definition at line 1137 of file test/__init__.py.

def IMP.test.get_example_path (   fname)

Return the full path to one of this module's example files.

Note
This function is only available in Python.

Definition at line 1142 of file test/__init__.py.

def IMP.test.get_module_name ( )

Return the fully-qualified name of this module.

Note
This function is only available in Python.

Definition at line 1132 of file test/__init__.py.

def IMP.test.get_module_version ( )

Return the version of this module, as a string.

Note
This function is only available in Python.

Definition at line 1127 of file test/__init__.py.

def IMP.test.main (   args,
  keys 
)

Run a set of tests; similar to unittest.main().

Obviates the need to separately import the 'unittest' module, and ensures that main() is from the same unittest module that the IMP.test testcases are. In addition, turns on some extra checks (e.g. trying to use deprecated code will cause an exception to be thrown).

Note
This function is only available in Python.

Definition at line 922 of file test/__init__.py.

def IMP.test.numerical_derivative (   func,
  val,
  step 
)

Calculate the derivative of the single-value function func at point val.

The derivative is calculated using simple finite differences starting with the given step; Richardson extrapolation is then used to extrapolate the derivative at step=0.

Note
This function is only available in Python.

Definition at line 73 of file test/__init__.py.

def IMP.test.temporary_directory (   dir = None)

Simple context manager to make a temporary directory.

The temporary directory has the same lifetime as the context manager (i.e. it is created at the start of the 'with' block, and deleted at the end of the block).

Parameters
dirIf given, the temporary directory is made as a subdirectory of that directory, rather than in the default temporary directory location (e.g. /tmp)
Returns
the full path to the temporary directory.
Note
This function is only available in Python.

Definition at line 58 of file test/__init__.py.

def IMP.test.temporary_working_directory ( )

Simple context manager to run in a temporary directory.

While the context manager is active (within the 'with' block) the current working directory is set to a temporary directory. When the context manager exists, the working directory is reset and the temporary directory deleted.

Note
This function is only available in Python.

Definition at line 43 of file test/__init__.py.

def IMP.test.xyz_numerical_derivatives (   sf,
  xyz,
  step 
)

Calculate the x,y and z derivatives of the scoring function sf on the xyz particle.

The derivatives are approximated numerically using the numerical_derivatives() function.

Note
This function is only available in Python.

Definition at line 109 of file test/__init__.py.