[Python-Dev] How far to go with user-friendliness
Dima Tisnek
dimaqq at gmail.com
Wed Jul 22 10:34:03 CEST 2015
Since I started this thread:
I like mock's magic
I appreciate plain language extra features (.called, .reset_mock(),
.side_effect, etc) [1]
I even appreciate assert* error magic [2]
assret* is just puzzling, unexpected.
[1]
those who want clear separation like `._assert_called_with()` are
going too far IMO.
Personally I'd rather use pytest style `assert m.call_count` than
`m.assert_called_with()` but that's just me
[2]
that caught another developer's bug in my codebase
On 16 July 2015 at 22:29, Michael Foord <fuzzyman at gmail.com> wrote:
>
>
> On Tuesday, 14 July 2015, Christie Wilson <bobcatfish at gmail.com> wrote:
>>> If people do misspell it, I think they do learn not to in after it
>>> happens a few times.
>>
>> Unless the line silently executes and they don't notice the mistake for
>> years :'(
>
> Indeed. This has been a problem with mock, misspelled (usually
> misremembered) assert methods silently did nothing.
>
> With this fix in place several failing tests were revealed in code bases!
>
> As for assret, it's the common misspelling people have told me about. It
> seems a ridiculous thing for people to get worked up about, but people enjoy
> getting worked up.
>
> Michael
>
>
>
>> On Tue, Jul 14, 2015 at 9:15 AM, Ron Adam <ron3200 at gmail.com> wrote:
>>>
>>>
>>> On 07/14/2015 09:41 AM, Steven D'Aprano 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.
>>>>> >
>>>>> >I disagree
>>>>
>>>> I must admit I don't use mock so don't quite understand what is going on
>>>> in this bug report. But I don't imagine that anything good will come out
>>>> of treating*one* typo differently from all the other possible typos.
>>>> Why should "assret" be treated differently from other easy-to-make typos
>>>> like "asert", "assrt", "asset"? Or "assort", which is not only a
>>>> standard and common English word, but "e" and "o" are right next to each
>>>> other on Dvorak keyboards, making it an easy typo to make.
>>>>
>>>> Surely this is an obvious case where the Zen should apply. "Special
>>>> cases aren't special enough..." -- either all such typos raise
>>>> AttributeError, or they are all silent.
>>>
>>> I agree with Steven that it doesn't seem correct to not raise
>>> AttributeError here.
>>>
>>> For what it's worth, I have a life long sleep disorder and am a tarrable
>>> (<-- like this) speller because of it. I still don't want spell, or
>>> grammar, checkers to not report my mistakes. And I don't recall ever making
>>> the particular error of using "assret" in place of "assert". I'd be more
>>> likely to mispell it as "assirt" if I wasn't already so familiar with
>>> "assert".
>>>
>>> If people do misspell it, I think they do learn not to in after it
>>> happens a few times.
>>>
>>> Regards,
>>> Ron
>>>
>>> _______________________________________________
>>> Python-Dev mailing list
>>> Python-Dev at python.org
>>> https://mail.python.org/mailman/listinfo/python-dev
>>> Unsubscribe:
>>> https://mail.python.org/mailman/options/python-dev/bobcatfish%40gmail.com
>>
>>
>>
>> --
>> Christie Wilson
>
> --
>
> http://www.voidspace.org.uk/
>
> May you do good and not evil
> May you find forgiveness for yourself and forgive others
> May you share freely, never taking more than you give.
> -- the sqlite blessing http://www.sqlite.org/different.html
>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/dimaqq%40gmail.com
>
More information about the Python-Dev
mailing list