IMP logo
Public Member Functions | Public Attributes
IMP.test.TestCase Class Reference

Detailed Description

Super class for IMP test cases.

+ Inheritance diagram for IMP.test.TestCase:

List of all members.

Public Member Functions

def assertClassNames
 Check that all the classes in the module follow the imp naming conventions.
def assertFunctionNames
 Check that all the functions in the module follow the imp naming conventions.
def assertShow
 Check that all the classes in modulename have a show method.
def assertValueObjects
def assertXYZDerivativesInTolerance
 Assert that x,y,z analytical derivatives match numerical within a tolerance, or a percentage (of the analytical value), whichever is larger.
def check_unary_function_deriv
 Check the unary function func's derivatives against numerical approximations between lb and ub.
def check_unary_function_min
 Make sure that the minimum of the unary function func over the range between lb and ub is at expected_fmin.
def create_particles_in_box
 Create a bunch of particles in a box.
def create_point_particle
 Make a particle with optimizable x, y and z attributes, and add it to the model.
def failure_probability
 Estimate how like a given block of code is to raise an AssertionError.
def get_input_file_name
 Get the full name of an input file in the top-level test directory.
def get_magnitude
def get_tmp_file_name
 Get the full name of an output file in the build/tmp directory.
def open_input_file
 Open and return an input file in the top-level test directory.
def particle_distance
 Return distance between two given particles.
def probabilistic_test
 Help handle a test which is expected to fail some fraction of the time.
def randomize_particles
 Randomize the xyz coordinates of a list of particles.
def run_example
 Run the named example script.
def setUp
def tearDown

Public Attributes

 start_time
 words

Member Function Documentation

def IMP.test.TestCase.assertClassNames (   self,
  module,
  exceptions,
  words 
)

Check that all the classes in the module follow the imp naming conventions.

def IMP.test.TestCase.assertFunctionNames (   self,
  module,
  exceptions,
  words 
)

Check that all the functions in the module follow the imp naming conventions.

def IMP.test.TestCase.assertShow (   self,
  modulename,
  exceptions 
)

Check that all the classes in modulename have a show method.

def IMP.test.TestCase.assertXYZDerivativesInTolerance (   self,
  model,
  xyz,
  tolerance = 0,
  percentage = 0 
)

Assert that x,y,z analytical derivatives match numerical within a tolerance, or a percentage (of the analytical value), whichever is larger.

def IMP.test.TestCase.check_unary_function_deriv (   self,
  func,
  lb,
  ub,
  step 
)

Check the unary function func's derivatives against numerical approximations between lb and ub.

def IMP.test.TestCase.check_unary_function_min (   self,
  func,
  lb,
  ub,
  step,
  expected_fmin 
)

Make sure that the minimum of the unary function func over the range between lb and ub is at expected_fmin.

def IMP.test.TestCase.create_particles_in_box (   self,
  model,
  num = 10,
  lb = [0,
  ub = [10 
)

Create a bunch of particles in a box.

def IMP.test.TestCase.create_point_particle (   self,
  model,
  x,
  y,
  z 
)

Make a particle with optimizable x, y and z attributes, and add it to the model.

def IMP.test.TestCase.failure_probability (   self,
  testcall 
)

Estimate how like a given block of code is to raise an AssertionError.

def IMP.test.TestCase.get_input_file_name (   self,
  filename 
)

Get the full name of an input file in the top-level test directory.

def IMP.test.TestCase.get_tmp_file_name (   self,
  filename 
)

Get the full name of an output file in the build/tmp directory.

def IMP.test.TestCase.open_input_file (   self,
  filename,
  mode = 'rb' 
)

Open and return an input file in the top-level test directory.

def IMP.test.TestCase.particle_distance (   self,
  p1,
  p2 
)

Return distance between two given particles.

def IMP.test.TestCase.probabilistic_test (   self,
  testcall,
  chance_of_failure 
)

Help handle a test which is expected to fail some fraction of the time.

The test is run multiple times and an exception is thrown only if it fails too many times.

def IMP.test.TestCase.randomize_particles (   self,
  particles,
  deviation 
)

Randomize the xyz coordinates of a list of particles.

def IMP.test.TestCase.run_example (   self,
  filename 
)

Run the named example script.

A dictionary of all the script's global variables is returned. This can be queried in a test case to make sure the example performed correctly.


The documentation for this class was generated from the following file:

Generated on Tue May 22 2012 23:33:38 for IMP by doxygen 1.8.1