PyUtilib / pyutilib

A collection of general Python utilities, including logging and file IO, subprocess management, plugin systems, and workflow management.
BSD 3-Clause "New" or "Revised" License
34 stars 21 forks source link

Create a new assertion for filtered file comparison #2

Open whart222 opened 8 years ago

whart222 commented 8 years ago

We could use a new assertion that can use more complex filters (i.e. more than just the single-line filtering supported by assertFileEqualsBaseline).

The idea is to accept two new parameters:

a filter function that takes a stream / string and returns filtered stream / string.
a comparison function 

The motivating case is checking PICO results with a non-zero optimality gap: the filter would parse through the result file and identify and return the final solution, and the comparison function would implement "assertLessThan(result, baseline*(1+gap))"