3 ms·
> Simple: use mocker.patch to patch out random.randrange and have it return a fixed sequence of results that would imply a known result. Thank you for this. An
by nanis 6y ago
> Simple: use mocker.patch to patch out random.randrange and have it return a fixed sequence of results that would imply a known result.
Thank you for this. Another way to put this is "your tests for code that uses a 3rd party API should not amount to an uptime test for the 3rd party API."
Some time ago, I observed that tests in the Boost.Accumulators library were similarly confounding tests for the code one wrote vs tests of statistical hypotheses:
https://www.nu42.com/2016/12/cpp-boost-median-test.html https://www.nu42.com/2016/12/cpp-boost-median-test.html