[Python-Dev] Proposed unittest changes

Nick Coghlan ncoghlan at gmail.com
Mon Jul 14 11:14:20 CEST 2008


Ben Finney wrote:
> Steve Holden <steve at holdenweb.com> writes:
> 
>> Michael Foord wrote:
>>> Adding the following new asserts:
>>>
>>>    assertIn    (member, container, msg=None)
>>>    assertNotIn     (member, container, msg=None)
>>>    assertIs     (first, second, msg=None)
>>>    assertNotIs   (first, second, msg=None)
>> Please, let's call this one "assertIsNot". I know it's valid Python
>> to say
>>
>>   if a not is b:
>>
>> but it's a much less natural way of expressing the condition, and
>> (for all I know) might even introduce an extra negation operation.
>> "is not" is, I believe, treated as a single operator.
> 
> Dang. You're exactly right.
> 
> The problem is, that makes it quite inconsistent with other "not" uses
> (such as "assert_not_equal", "assert_not_in", etc.) I would really
> prefer that all these "not" uses be gramatically consistent for
> predictability. Is this a case where "assert_is_not" should exist
> alongside "assert_not_is"?

If we can flip the word order in the language syntax, we can sure as 
heck flip it in a method name :)

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-Dev mailing list