Class MockObject
source code
object --+
|
MockObject
An object that takes a hashmap and uses it for the attributes on the
object. Setting attributes is ignored. Retrieving an unknown attribute
returns an empty MockObject. The key 'return__' is special in that its
corresponding value will be returned if the object is called as a
function.
>>> a=MockObject(b='c')
>>> a.b
'c'
>>> a.d
{}
>>> a.d.e
{}
>>> x=MockObject(return__=5)
>>> y=MockObject(z=x)
>>> y.z()
5
- Overrides:
object.__init__
- (inherited documentation)
|
- Overrides:
object.__repr__
- (inherited documentation)
|
__str__(self)
(Informal representation operator)
| source code
|
- Overrides:
object.__str__
- (inherited documentation)
|