[EMAIL PROTECTED] wrote:
Peter,

for a object foo who need a iterator to do a job,  i write test to make
sure the foo correctlly used the iterator, so a simple empty iterator
is not enough.  because in the case, i need to see if or not the foo
called the iterator to get the proper data from it and do the proper
translating on them.  so, the mock iterator i need should be such an
iterator which can returns be iterated out a lot of test data as i
willed.

See Terry's reply which referenced my posting to better understand the point I was making.

i guess you are not familar with unit testing.

Your guess is wrong.

we need mock objects
not because they are hard to implemented, we need them to make the
tests easy and fine.

Thanks for the tutorial. :-) I'm rather well acquainted with unit testing and mock objects.

My point was merely that what Terry suggested did not act the
way I thought he was proposing that it acted, and I was
hoping to correct that.  Not having actually read and understood
your entire original question, I didn't know at the time and
still don't know what you *really* need, just that Terry's
suggestion looked like a bit of a brain fart. :-)

For what it's worth, I tend to be of the school that says that
overuse of mock objects is a "testing smell", and as part of
acting on that belief I avoid using generic mock objects.
Instead, I write minimal ones which are carefully customized
for a particular test, to make sure that the resulting mock
object's code clearly tells a reader of the test exactly what
it is trying to accomplish.  Generic mocks, on the other hand,
tend to get overused and rarely make the tests very readable,
IMHO.

-Peter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to