
On Mon, Jan 26, 2015 at 05:10:44PM -0800, Chris Barker wrote:
That being said .. if if we want to say the primary use case is testing that's fine with me -- just please not buried in unittest.TestCase somewhere.
Apart from doctest, which I think is completely inappropriate, where else would you put this for testing? For testing, I think it needs to be a TestCase.assert* method. Otherwise you have people writing self.assertTrue(close_enough(a, b)) I know this because that's exactly how my assertApproxEqual test assertion started. I'd write tests like that, they would fail, and I'd have no idea why. Fast forward past a few code iterations, and I had an assertion method which give me some useful diagnostics when it failed, e.g.: AssertionError: 20.666666666666668 != 20.66666667 values differ by more than tol=0 and rel=1e-12 -> absolute error = 3.33333360913457e-09 -> relative error = 1.612903358998517e-10 -- Steve