[Patches] [ python-Patches-1141428 ] more __contains__ tests

SourceForge.net noreply at sourceforge.net
Fri Feb 25 01:22:13 CET 2005


Patches item #1141428, was opened at 2005-02-17 19:42
Message generated for change (Comment added) made by jimjjewett
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1141428&group_id=5470

Category: Tests
Group: Python 2.5
Status: Open
Resolution: None
Priority: 4
Submitted By: Jim Jewett (jimjjewett)
Assigned to: Raymond Hettinger (rhettinger)
Summary: more __contains__ tests

Initial Comment:
Recently, there was a change to speed up 
__contains__.  

x in (1, 2, 3) would be compiled as 
x in frozenset(1, 2, 3).

This was backed out, because frozensets raise a 
typeerror when asked about unhashable objects.  
These objects *can't* be in the set, but there was 
concern about supporting objects in which a mutable 
and an immutable compare equal.

So long as that is a requirement, it should be tested.  

The new test for sequences ensures that they will use 
__eq__ (and not rely on __hash__) in the future.  

The change to the rich compare tests is just a 
comment, pointing out that dicts can rely on 
__hash__ as well as __eq__.

----------------------------------------------------------------------

>Comment By: Jim Jewett (jimjjewett)
Date: 2005-02-24 19:22

Message:
Logged In: YES 
user_id=764593

Period moved, per mcherm's comment.

----------------------------------------------------------------------

Comment By: Michael Chermside (mcherm)
Date: 2005-02-23 08:26

Message:
Logged In: YES 
user_id=99874

In the change to test_richcmp.diff, you should move the
period to the end of the sentence.

That being said, I'm +1 on applying this patch. I certainly
agree that we should add the test since we care about
preserving the behavior.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1141428&group_id=5470


More information about the Patches mailing list