Package schrodinger :: Package test :: Package stu :: Package outcomes :: Module standard_workups
[hide private]
[frames] | no frames]

Module standard_workups

Contains the class _PropertyCompare, and several functions to perform test workups.

The most commonly used workup is compare_ct_property


Copyright: Schrodinger, LLC. All rights reserved.

Classes [hide private]
  WorkupFailure
  _PropertyCompare
Compare properties between a ct and a csv file generated from a ct via proplister.
Functions [hide private]
 
lines_in_file(file_expr, num_lines_target, tolerance)
Counts the number of lines in one or more files matching a single shell expansion expression, file_expr and checks that they are within +/- tolerance of num_lines_target.
 
_check_files(filenames, exist=True)
Checks if files either all exist (default) or all don't exist.
 
files_exist(*filenames)
Checks to see if all the files exist.
 
file_exists(*filenames)
Alias for backwards compatibility.
 
many_files_exist(input_file)
Checks to see if all the files exist.
 
files_dont_exist(*filenames)
Checks to see if all the files don't exist.
 
_get_ct_count(filename)
Return number of cts contained in a given file
 
cts_in_file(filename, num_cts_target, tolerance=0)
Counts the number of cts in a file and checks that its within +/- range of the expected number of cts.
 
cts_less_than(filename, num_cts_upper_bound)
Check that filename has fewer than num_cts_upper_bound cts.
 
cts_greater_than(filename, num_cts_lower_bound)
Check that filename has greater than num_cts_lower_bound cts.
 
compare_ct_property(filename, inp_property, inp_property_target, tolerance=0)
Compare property in the first ct to a user-provided value.
 
parse_log_file(file_expr, pattern, occurrences=1)
Search file for a string.
 
strict_evaluate_ct_properties(stdvalue_file, structure_file)
Please use compare_ct_properties if possible.
 
evaluate_ct_properties(stdvalue_file, structure_file)
Please use compare_ct_properties if possible.
 
check_for_all_expected_cts(stdvalue_file, structure_file)
Look for the existence of all expected cts.
 
compare_files(filea, fileb, *options)
Find the diff of two files and compare the output.
 
untar(tar_name, *filenames)
Extracts a file from a tar file.
 
unzip(zip_name, *filenames)
Extracts a file from a zip file.
 
expect_job_failure()
Expect the job to have a "bad" exit status.
Variables [hide private]
  logger = log.get_logger('test_backend')
  __package__ = 'schrodinger.test.stu.outcomes'
Function Details [hide private]

lines_in_file(file_expr, num_lines_target, tolerance)

 

Counts the number of lines in one or more files matching a single shell expansion expression, file_expr and checks that they are within +/- tolerance of num_lines_target.

usage: lines_in_file(file, num_lines_target, tolerance)

_check_files(filenames, exist=True)

 

Checks if files either all exist (default) or all don't exist.

Parameters:
  • filenames (list) - List of filenames or shell expansion expressions representing filenames.
  • filenames (list) - Whether to expect the files to exist or not.
  • exist (bool)

files_exist(*filenames)

 

Checks to see if all the files exist. Inputs are assumed to be filenames or shell expansion expressions representing filenames.

usage: files_exist(file1, file2, ...)

file_exists(*filenames)

 

Alias for backwards compatibility.

many_files_exist(input_file)

 

Checks to see if all the files exist. Input is assumed to be a file containing list of filenames or shell expansion expressions representing filenames - one filename per line.

usage: many_files_exist(input_file)

files_dont_exist(*filenames)

 

Checks to see if all the files don't exist. Input is assumed to be a list of filenames or shell expansion expressions representing filenames.

usage: files_dont_exist(file1, file2, ...)

cts_in_file(filename, num_cts_target, tolerance=0)

 

Counts the number of cts in a file and checks that its within +/- range of the expected number of cts.

usage: cts_in_file(file, num_cts_target, tolerance)

compare_ct_property(filename, inp_property, inp_property_target, tolerance=0)

 

Compare property in the first ct to a user-provided value.

usage: compare_ct_property(filename, inp_property, inp_property_target, [tolerance]) Tolerance only works for properties that start with i or r (integers or floats).

parse_log_file(file_expr, pattern, occurrences=1)

 

Search file for a string. Expected arguments are [file_expression, string, [occurrences]]. If string is found in every file that matches the shell glob expression file_expr, outcome is True. Thus, multiple files are specified by wildcarding.

usage: parse_log_file(file_expr, pattern, [occurrences])

strict_evaluate_ct_properties(stdvalue_file, structure_file)

 

Please use compare_ct_properties if possible.

Compare a subset of ct level properties for cts in a file against standard values using strict evaluation.

All properties must match within the provided per-value range in order for the comparison to be a success. Also checks that all expected cts (rows) in standard file have a corresponding match in the structure file. The structure file can have additional cts though. Uses PropertyCompare file format: https://wiki.schrodinger.com/QA/PropertyCompare

Use the evaluate_ct_properties workup instead to prevent a failure from being triggered when a ct in the standard file is not found in the structure file.

evaluate_ct_properties(stdvalue_file, structure_file)

 

Please use compare_ct_properties if possible.

Compare a subset of ct level properties for cts in a file against standard values.

All properties must match within the provided per-value range in order for the comparison to be a success. Uses PropertyCompare file format: https://wiki.schrodinger.com/QA/PropertyCompare

Note that a failure will NOT be triggered if a ct (row) in the standard file is not located in the structure file. To ensure that all cts in the standard match an entry in the comparison file, please use the workup strict_evaluate_ct_properties.

check_for_all_expected_cts(stdvalue_file, structure_file)

 

Look for the existence of all expected cts.

The structure file can have additional cts. Uses PropertyCompare standard file format: https://wiki.schrodinger.com/QA/PropertyCompare

usage: check_for_all_expected_cts(std_file, str_file)

compare_files(filea, fileb, *options)

 

Find the diff of two files and compare the output.

Compare script takes the following arguments.

usage: compare_files(filea, fileb, -option1, -option2)

Options:

  <cutoff>        Absolute or relative diff allowed btw numerical fields.
                  Must be a positive number. The default is 0.00001.
  -r|-rel         Compare relative differences btw differing fields.
                  This is the default.
  -a|-abs         Compare absolute differences btw differing fields.
                  The default is to compare relative differences.
  -m|-mag <mag>   Minimum magnitude to use for assessing relative diffs.
                  Must be positive.  The default value is 1.0.
  -z              Compare magnitudes only (ignore sign differences).
  -s|-skip <file> File containing regexps for lines to ignore.
                  By default the file './skip_lines' is used.

untar(tar_name, *filenames)

 

Extracts a file from a tar file.

The files file1, file2, etc. will be extracted from tarName. Extract all the files in tarName, if no filename is specified.

usage: untar(tar_name, file1, file2, ...)

unzip(zip_name, *filenames)

 

Extracts a file from a zip file.

The files file1, file2, etc. will be extracted from zipName.

Extract all the files in zipName,if no file name is specified

usage: unzip(zip_name, file1, file2, ...)

expect_job_failure()

 

Expect the job to have a "bad" exit status. If this workup is included, the test will FAIL if it has a successful exit status and SUCCEED if it has a bad exit status. This is opposite of the usual behavior.