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

Ethan Furman ethan at stoneleaf.us
Tue Jul 14 18:53:33 CEST 2015

On 07/14/2015 07:06 AM, Paul Moore wrote:
> On 14 July 2015 at 14:51, Florian Bruhin wrote:
>>> On Tue, Jul 14, 2015 at 02:06:14PM +0200, Dima Tisnek wrote:

>>>> https://bugs.python.org/issue21238 introduces detection of
>>>> missing/misspelt mock.assert_xxx() calls on getattr level in Python
>>>> 3.5
>>>> Michael and Kushal are of the opinion that "assret" is a common typo
>>>> of "assert" and should be supported in a sense that it also triggers
>>>> AttributeError and is not silently ignored like a mocked user
>>>> attribute.

This is ridiculous.

>> With the patch, an AttributeError is raised if you call something
>> starting with assert or assret instead.

> In effect, this patch is "reserving" all attributes starting with
> "assert" or "assret" as actual methods of the mock object, and not
> mocked attributes.
> Reserving "assert" seems fair.


> Reserving "assret" seems odd, as people say why just this
> mis-spelling?

Refuse the temptation to guess.  Imagine that English is not the only language people use, and assret is either an actual word or logical abbreviation in some other language -- we just broke their tests.

Part of writing tests is making sure they fail (and for the right reason) -- proper testing of the tests would reveal such a typo.


More information about the Python-Dev mailing list