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

Module compare_csv'

See compare_csv docstring

$Revision 0.2 $


Copyright: (c) Schrodinger, LLC. All rights reserved

Functions [hide private]
 
compare_csv(test_file, ref_file, tolerance=0.005, lines=-1)
Workup for comparing two CSV files.
 
compare_lists(index, test, ref, tolerance=0.005)
Loop over elements in line comparing each test element to a reference.
 
help()
 
is_empty(inh)
Function to check if iterable csv object is empty.
Variables [hide private]
  ALL_LINES = -1
  DEFAULT_TOLERANCE = 0.005
  __package__ = 'schrodinger.test.stu.outcomes'
Function Details [hide private]

compare_csv(test_file, ref_file, tolerance=0.005, lines=-1)

 

Workup for comparing two CSV files.

Example use:

   outcome_workup = compare_csv(test.csv, ref.csv, <0.05>, <3>)

The third argument is optional. It is a tolerance to be used for values that can be cast as floats. Equality is required for values that cannot be cast as floats (strings for example).

The fourth argument is optional. It is the number of lines to compare. In the example above, the first 3 lines will be compared. If this argument is left off, all lines are compared and the total length of both files is required to be the same. In this case, all excess lines will be printed to stdout as part of an error message.

The lines in each CSV file are expected to line up (i.e. line 1 in test.csv is compared with line 1 from ref.csv). This means if a line is skipped in test.csv all subsequent lines will cause failures (so many failure messages will be printed - one for each line after the skip).

compare_lists(index, test, ref, tolerance=0.005)

 

Loop over elements in line comparing each test element to a reference. Elements that cannot be cast as floats are compared for an exact match. Elements that can be cast as floats are compared using tolerance, which is zero by default.

is_empty(inh)

 

Function to check if iterable csv object is empty. Prints all excess lines if it is not.