garybernhardt / dingus

A record-then-assert mocking library.

Clone this repository (size: 73.7 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/garybernhardt/dingus/
commit 39: e57304333549
parent 38: a30c30d25309
branch: default
Added ability to specify method return values when creating dinguses
Gary Bernhardt
12 months ago

Changed (Δ210 bytes):

raw changeset »

dingus.py (5 lines added, 1 lines removed)

Up to file-list dingus.py:

@@ -100,7 +100,11 @@ class Dingus(object):
100
100
        self._full_name = full_name
101
101
102
102
        for attr_name, attr_value in kwargs.iteritems():
103
            setattr(self, attr_name, attr_value)
103
            if attr_name.endswith('__returns'):
104
                attr_name = attr_name.replace('__returns', '')
105
                setattr(self, attr_name, lambda *args, **kwargs: attr_value)
106
            else:
107
                setattr(self, attr_name, attr_value)
104
108
105
109
        self._replace_init_method()
106
110