Open 12rambau opened 9 months ago
Hey @12rambau,
Hmm good point. I think this would be a nice feature to have.
either an opt-in file format in num_regression or a special handle of numercal values in data_regresion ?
I think we should focus on the purpose of the function rather, than the data format the existing functions use, so I think an option to use a different data-format in num_regression
makes more sense.
Something like:
class NumericFileFormat(Enum):
Yaml = auto()
Csv = auto()
class NumericRegressionFixture(DataFrameRegressionFixture):
"""
Numeric Data Regression fixture implementation used on num_regression fixture.
"""
def check(
self,
data_dict: Dict[str, Any],
basename: Optional[str] = None,
fullpath: Optional["os.PathLike[str]"] = None,
tolerances: Optional[Dict[str, Dict[str, float]]] = None,
default_tolerance: Optional[Dict[str, float]] = None,
data_index: Optional[Sequence[int]] = None,
fill_different_shape_with_nan: bool = True,
*,
file_format = NumericFileFormat.Csv,
) -> None:
Would be happy review a PR with that change if you want to contribute.
cc @tadeu @tarcisiofischer
I'm happy to contribute, i just need to find the time to do so 😢 Whenver it will be rainy outside i'll have a look
It's not a matter of making the actual test, it's a matter of checking a problem if no arise.
I'm moving from data_regression to num_regression as the value I compare are all numbers and changes from time to time (at the 10th decimal so not relevant). the previously generated file was super easy to humanly review looking like this:
Now the output is .csv and it's barely readable (from a human standpoint):
I would like to get the best of 2 worlds, the display of an easy to read yaml file (data_regression) and the comparaison of numercial value (num_regression). Do you think it could be an added feature ?
either an opt-in file format in
num_regression
or a special handle of numercal values indata_regresion
?