class TestClip:
Undocumented
Undocumented
A property-based test using Hypothesis.
This aims for maximum generality: it could in principle generate any valid inputs to np.clip, and in practice generates much more varied inputs than human testers come up with.
Because many of the inputs have tricky dependencies - compatible dtypes
and mutually-broadcastable shapes - we use st.data()
strategy draw
values inside the test function, from strategies we construct based
on previous values. An alternative would be to define a custom strategy
with @st.composite
, but until we have duplicated code inline is fine.
That accounts for most of the function; the actual test is just three lines to calculate and compare actual vs expected results!
Undocumented
Undocumented
Undocumented
Undocumented