OpenMined / PipelineDP

PipelineDP is a Python framework for applying differentially private aggregations to large datasets using batch processing systems such as Apache Spark, Apache Beam, and more.
https://pipelinedp.io/
Apache License 2.0
270 stars 75 forks source link

Make histogram.max_value to be method instead of property #471

Closed dvadym closed 1 year ago

dvadym commented 1 year ago

This is done mainly to simplify mocking, while there is no particular reason, namely mocking of properties are complicated, it requires mocking of classes, like

setattr(mock_l0_histogram.__class__, 'max_value', 6)

But such mocking is bad, because it changes value of max_value in other tests :(. For example the test_count in parameter_tuning.py was incorrect because of incorrect max_value.

The simplest solution is to make max_value to be method, which seems to be not worse than property.