IMP logo
IMP Reference Guide  2.5.0
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.

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  RunInTempDir
 Simple RAII-style class to run in a temporary directory. More...
 
class  TempDir
 Simple RAII-style class to make a temporary directory. More...
 
class  TestCase
 Super class for IMP test cases. More...
 

Functions

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 xyz_numerical_derivatives
 Calculate the x,y and z derivatives of the scoring function sf on the xyz particle. More...
 

Standard module functions

All IMP modules have a set of standard functions to help get information about the module and about files associated with the module.

std::string get_module_version ()
 
std::string get_module_name ()
 
std::string get_data_path (std::string file_name)
 Return the full path to one of this module's data files. More...
 
std::string get_example_path (std::string file_name)
 Return the full path to one of this module's example files. More...
 

Function Documentation

std::string IMP::test::get_data_path ( std::string  file_name)

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

To read the data file "data_library" that was placed in the data directory of this module, do something like

std::ifstream in(IMP::test::get_data_path("data_library"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own data directory, so be sure to use this function from the correct module.
std::string IMP::test::get_example_path ( std::string  file_name)

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

To read the example file "example_protein.pdb" that was placed in the examples directory of this module, do something like

std::ifstream in(IMP::test::get_example_path("example_protein.pdb"));

This will ensure that the code works both when IMP is installed or if used via the setup_environment.sh script.

Note
Each module has its own example directory, so be sure to use this function from the correct module.
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 1036 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 427 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 463 of file test/__init__.py.