Re: [Python-ideas] Unittest error message failure context lazy creation

2017-08-27 Thread francismb
Hi Chris, Hi Steven, > Have you measured it, eg by replacing the message with a constant? By > what percentage does it speed up a successful test run? How far is significant for `one` test? Please exchange the zip method against `itertools.product` and some message creation with concatenation (us

Re: [Python-ideas] Unittest error message failure context lazy creation

2017-08-26 Thread Steven D'Aprano
On Sat, Aug 26, 2017 at 08:25:41PM +0200, francismb wrote: > Hi all, > while using `unittest` I see the pattern of creating an error message > with the test context for the case that some `assert...` methods fails > (to get a good error message). On the lines: [...] > The `msg` is just used in case

Re: [Python-ideas] Unittest error message failure context lazy creation

2017-08-26 Thread Chris Angelico
On Sun, Aug 27, 2017 at 4:25 AM, francismb wrote: > Hi all, > while using `unittest` I see the pattern of creating an error message > with the test context for the case that some `assert...` methods fails > (to get a good error message). On the lines: > > class Test...(unittest.TestCase): > > lo

[Python-ideas] Unittest error message failure context lazy creation

2017-08-26 Thread francismb
Hi all, while using `unittest` I see the pattern of creating an error message with the test context for the case that some `assert...` methods fails (to get a good error message). On the lines: class Test...(unittest.TestCase): longMessage = True def test_(self): ... for a, b, c ...