Hi,
Anyone was using pmock for unit testing with python? I met a problem
and hope someone to help me. For short, the pmock seems can not mock a
iterator object.
For example, the tested object is foo, who need to send message to
another object bar. So, to test the foo, I need mock a mockBar. But
the bar is a iterator, the foo use the bar in this way:
foo.method(self, bar):
for n in bar:
do somthing
...
my purpose is create a mockBar and pass this mock object to
foo.method(), but this ideal simply does not work. Python will complain
that calling on an uniteraterable object. I'v already set anything
like mockBar.expects(__iter__()) and mockBar.expects(next()).
Does anyone has some clues?
-
narke
--
http://mail.python.org/mailman/listinfo/python-list