pyscal.utils.testing

Common functions and mock data for usage in pyscal testing

pyscal.utils.testing.check_linear_sections(wo_or_go)[source]

Check that the linear segments of a WaterOil or a GasOil object are linear.

Return type:

None

pyscal.utils.testing.check_table(dframe)[source]

Check that the numbers in a dataframe for WaterOil or GasOil has the properties that Eclipse enforces

Return type:

None

pyscal.utils.testing.float_df_checker(dframe, idxcol, value, compcol, answer)[source]

Looks up in a dataframe, selects the row where idxcol=value and compares the value in compcol with answer

Warning: This is slow code, but only the tests are slow

Floats are notoriously difficult to handle in computers.

Return type:

Union[bool_, ndarray]

pyscal.utils.testing.sat_table_str_ok(sat_table_str)[source]

Test that a supplied string from SWOF()/SGOF() etc is probably ok for Eclipse.

Number of floats pr. line must be constant All numerical lines must be parseable to a rectangular dataframe with only floats. The first column must contain only unique values for every SATNUM.

Return type:

None

pyscal.utils.testing.series_decreasing(series)[source]

Weaker than pd.Series.is_monotonic_decreasing, allows constant parts.

We do not enforce less than zero here, because there will be some positive differences due to representation errors which is ok in terms of numerical equivalence. It is not ok when dumped to Eclipse, so the representation of the dataframe as a SGOF table must be properly rounded before printed.

pyscal.utils.testing.series_increasing(series)[source]

Weaker than pd.Series.is_monotonic_increasing

pyscal.utils.testing.slow_hypothesis(slow_function)[source]

A decorator for tests that are always slow.

The default deadline for hypothesis is set through the hypothesis profile being used, and is set to None for CI runs (through a command line argument and code in conftest.py), meaning no deadline. On tests that are slow on local iron as well, we must ensure that the deadline set for these do not override the “no-deadline” in CI.