[Python-Dev] How far to go with user-friendliness

MRAB python at mrabarnett.plus.com
Wed Jul 15 00:28:40 CEST 2015


On 2015-07-14 23:05, Ethan Furman wrote:
> On 07/14/2015 02:53 PM, Robert Collins wrote:
>> On 15 July 2015 at 09:41, A.M. Kuchling <amk at amk.ca> wrote:
>>> On Tue, Jul 14, 2015 at 09:53:33AM -0700, Ethan Furman wrote:
>>>> Part of writing tests is making sure they fail (and for the right reason) -- proper testing of the tests would reveal such a typo.
>>>
>>> And there are other failure modes for writing tests that succeed but
>>> are not testing what you think.  For example, you might re-use the
>>> same method name:
>>>
>>>     def test_connection(self):
>>>         # Never executed
>>>         ...
>>>
>>>     ... 200 lines and 10 other test methods later ...
>>>
>>>     def test_connection(self):
>>>         ...
>>>
>>> Or misuse assertRaises:
>>>
>>>     with self.assertRaises(TypeError):
>>>         1 + "a"
>>>         # Second statement never reached
>>>         [] + 'b'
>>>
>>> I don't think unittest can protect its users from such things.
>>
>> It can't, but there is a sliding scale of API usability, and we should
>> try to be up the good end of that :).
>
> I hope you're not suggesting that supporting misspellings, and thereby ruling out the proper use of an otherwise fine variable name, is at the good end of that scale?
>
Somewhat OT, but did you know that the Unicode "Line_Break" property
has "Inseparable" as one of its possible values, and that "Inseperable"
is a permitted alias of it? <yuck/>



More information about the Python-Dev mailing list