title: Validating Python data transforms with parameter for expected result
body: <p>I'm writing a library of Python functions to transform a dataset, and for each one I need to make some basic checks on the transformed data:</p>
  
  <ol>
  <li>There should be no negative values in the dataset after transforming</li>
  <li>The sum of all values in the transformed dataset should be in some specified ratio to the sum of the values before transforming.</li>
  </ol>
  
  <p>For the first task, I can give all my functions a decorator with a name like <code>check_for_negatives</code>.</p>
  
  <p>For the second task however, the ratio of output to input will vary with each call to a particular function, depending on the input parameters - so the caller might expect the sum of the dataset to be unchanged, or to be x1.5, for different calls of the same function.</p>
  
  <p>The only way I can see to do this with decorators is to have a decorator to check the input:output ratio, but pass in the expected ratio as an argument to the function itself (though the function wouldn't use it directly). This doesn't seem very nice; is there a better way?</p>