kgashok / pymox

Automatically exported from code.google.com/p/pymox
Apache License 2.0
0 stars 0 forks source link

__contains__ is not prpoperly handled is class hiararchies #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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