Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__contains__ is not prpoperly handled is class hiararchies #39

Open
GoogleCodeExporter opened this issue Mar 19, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. create a class A that defines __contains__
2. create a class B that inherits from A but does not override __contains__
3. try to write a test and stub out __contains__ for the instance of B

You will get a TypeError raised because of current implementation __contains__ 
lookup:

...
    contains = self._class_to_mock.__dict__.get('__contains__', None)
    if contains is None:
      raise TypeError('unsubscriptable object')
...

What is the expected output? What do you see instead?

The __contains__ should be properly stubbed out in class B object instance

What version of the product are you using? On what operating system?
Python 2.7.2
Windows



Original issue reported on code.google.com by okosen...@gmail.com on 3 Sep 2011 at 1:01

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant