[Python-Dev] Proposed unittest changes

Ben Finney bignose+hates-spam at benfinney.id.au
Mon Jul 14 01:20:23 CEST 2008


Michael Foord <fuzzyman at voidspace.org.uk> writes:

> 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)
>    assertRaisesWithMessage    (exc_class, message, callable, *args,
> **keywargs)
[…]

>    assertLessThan
>    assertGreaterThan
>    assertLessThanOrEquals
>    assertGreaterThanOrEquals
[…]

>    assertListEqual(self, list1, list2, msg=None):
>    assertDictEqual(self, d1, d2, msg=None):
>    assertMultiLineEqual(self, first, second, msg=Non
[…]

>    assertSameElements(self, expected_seq, actual_seq, msg=None):

All these are new, so there is no existing expectation of these names
from users of the standard library 'unittest' module (i.e. no
backward-compatibility concern since these are new methods).

If we're planning to deprecate the existing non-PEP-8 names in 2.7 and
3.1, why would we introduce new names that are non-PEP-8? Wouldn't it
be better to add these as PEP-8 compatible names in the first
instance?

-- 
 \       “You've got the brain of a four-year-old boy, and I'll bet he |
  `\                         was glad to get rid of it.” —Groucho Marx |
_o__)                                                                  |
Ben Finney



More information about the Python-Dev mailing list