It is really nice have function-independent test code as it ensures that the test code isn't just a duplication of the C++ code containing the same mistakes (or vice versa). Unless the code is really different it doesn't really test anything. For Cosine it is fine as it is trivial, for WLC it was not fine as there were some issues with missing constants.Yes,we could write Python code to calculate numerical derivatives, but thisseems unnecessary to me because I know that the derivative of x^3 is 3x^2 and so can just write that in the Python code. That's what's done in the existing patch.