(Contributed by Walter Dörwald).
* Convert three test modules to unittest format.
* Expanded coverage in test_structseq.py.
* Raymond added a new test in test_sets.py
* Relaxed the argument restrictions for non-operator methods. They now
allow any iterable instead of requiring a set. This makes the module
a little easier to use and paves the way for an efficient C
implementation which can take better advantage of iterable arguments
while screening out immutables.
* Deprecated Set.update() because it now duplicates Set.union_update()
* Adapted the tests and docs to include the above changes.
* Added more test coverage including testing identities and checking
to make sure non-restartable generators work as arguments.
Will backport to Py2.3.1 so that the interface remains consistent
across versions. The deprecation of update() will be changed to
a FutureWarning.
and test_support.run_classtests() into run_unittest()
and use it wherever possible.
Also don't use "from test.test_support import ...", but
"from test import test_support" in a few spots.
From SF patch #662807.
assertRaises. Fixed a repeated subtle bug in the inplace tests by
removing the possibilty that a self.fail() call could raise a
TypeError that the test catches by mistake.
Allow mixed-type __eq__ and __ne__ for Set objects. This is messier than
I'd like because Set *also* implements __cmp__. I know of one glitch now:
cmp(s, t) returns 0 now when s and t are both Sets and s == t, despite
that Set.__cmp__ unconditionally raises TypeError (and by intent). The
rub is that __eq__ gets tried first, and the x.__eq__(y) True result
convinces Python that cmp(x, y) is 0 without even calling Set.__cmp__.
The _update method detected mutable elements by trapping TypeErrors.
Unfortunately, this masked useful TypeErrors raised by the iterable
itself. For cases where it is possible for an iterable to raise
a TypeError, the iterable is pre-converted to a list outside the
try/except so that any TypeErrors propagate through.
underlying dictionaries, there were no reasonable use cases (lexicographic
sorting of a list of sets is somewhat esoteric). Frees the operators
for other uses (such as strict subset and superset comparisons).
Updated documentation and test suite accordingly.
the inplace operators. The strategy is to have the operator overloading
code do the work and then to define equivalent method calls which rely on
the operators. The changes facilitate proper application of TypeError
and NonImplementedErrors.
Added corresponding tests to the test suite to make sure both the operator
and method call versions get exercised.
Add missing tests for difference_update().