[docs] Doc: remove errors about mixed-type comparisons. (issue 12067)

vadmium+py at gmail.com vadmium+py at gmail.com
Fri Mar 13 03:21:38 CET 2015

File Lib/test/test_compare.py (right):

Lib/test/test_compare.py:328: def assert_insts(self, i1, i2, equal,
comp, i1_meth=(), i2_meth=()):
On 2015/03/02 18:56:14, andymaier wrote:
> Will change name to assert_comparisons, for now. I will split up the
> _subtest methods into six, for better identification based on
subTest() (I
> really like that), but if I look at the number of calls to
> I don't think I'd like to duplicate them.

Fair enough. Though I think only one of those functions would need to be
called at a time, depending on whether comp was None or not. So
assert_equality_only() would check for TypeError, and
assert_total_order() would try all six comparisons. I don’t think there
would be duplicate calls.

Lib/test/test_compare.py:569: self.assert_insts(c1, c1, True,   0,
Class_str.meth, Class_str.meth)
On 2015/03/02 18:56:15, andymaier wrote:
> On the empty tuple meths: I wanted to have one place that has the
knowledge that
> there are no meths, instead of repeating that in every invocation of
> assert_insts().
> But I'm ok either way. Let me know which way you would recommend to

Since you have now expanded the doc string for assert_comparisons() to
say the meths tuples are only needed for custom classes, I think it
would be consistent to remove them here.

File Lib/test/test_compare.py (right):

Lib/test/test_compare.py:343: comp:       Integer indicating the
expected order comparison result:

“Integer indicating the expected order comparison result. Requires i1
and i2 to be totally ordered, meaning that at least one comparison is

Either i1 <= i2 or i1 >= i2 being true essentially means the pair of
objects are totally ordered. E.g. considering i1={"a"} and i2={"b"},
there is no valid comp value (short of something exotic like NaN).

Lib/test/test_compare.py:366: i1_meth = ()
I think the code was simpler before with the parameter i1_meth=()
default in the function definition

Lib/test/test_compare.py:609: self.assertTrue(c2 is not c3, "Testcase
error: c2 is c3")
Could use assertIsNot() here, and in other places

Lib/test/test_compare.py:614: self.assertTrue(s2 is s3, "Testcase error:
s2 is not s3")


More information about the docs mailing list