unit tests for error messages
I just made a change to some error messages [1] (really, just one): old behavior: '%o' % 3.14 'float' object cannot be interpreted as an integer new behavior: '%o' % 3.14 %o format: an integer is required, not float Would we normally add a test for that? -- ~Ethan~ [1] Issue 19995: http://bugs.python.org/issue19995
On Wed, 19 Mar 2014 10:53:31 -0700 Ethan Furman <ethan@stoneleaf.us> wrote:
I just made a change to some error messages [1] (really, just one):
old behavior:
'%o' % 3.14 'float' object cannot be interpreted as an integer
new behavior:
'%o' % 3.14 %o format: an integer is required, not float
Would we normally add a test for that?
Depends if you're fearing a regression. Regards Antoine.
Am 19.03.2014 19:55, schrieb Antoine Pitrou:
On Wed, 19 Mar 2014 10:53:31 -0700 Ethan Furman <ethan@stoneleaf.us> wrote:
I just made a change to some error messages [1] (really, just one):
old behavior:
'%o' % 3.14 'float' object cannot be interpreted as an integer
new behavior:
'%o' % 3.14 %o format: an integer is required, not float
Would we normally add a test for that?
Depends if you're fearing a regression.
If he fears regressions in error messages, he shouldn't be changing them in the first place :) Georg
On Wed, 19 Mar 2014 20:32:38 +0100, Georg Brandl <g.brandl@gmx.net> wrote:
Am 19.03.2014 19:55, schrieb Antoine Pitrou:
On Wed, 19 Mar 2014 10:53:31 -0700 Ethan Furman <ethan@stoneleaf.us> wrote:
I just made a change to some error messages [1] (really, just one):
old behavior:
'%o' % 3.14 'float' object cannot be interpreted as an integer
new behavior:
'%o' % 3.14 %o format: an integer is required, not float
Would we normally add a test for that?
Depends if you're fearing a regression.
If he fears regressions in error messages, he shouldn't be changing them in the first place :)
In this type of situation I will often write a unit test that makes sure that the piece of information I just added to the message is really in the message ('%o', in this case), using assertRaisesRegex. I don't think it is required, but I like to do it, because it would indeed be a regression if that information stopped appearing in the message. --David
participants (4)
-
Antoine Pitrou -
Ethan Furman -
Georg Brandl -
R. David Murray