Peter,
I'm so sorry, the letter was originally wrote to Terry, not to you!
I guess Terry not very familar to unit testing because he said:
-- cut --
I am not familiar with pmock, but my impression is that mock objects
are
for objects that you may not have available, such as a connection to a
data
[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 d
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
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>> def mockit(): raise StopIteration
This was meant to be a generator function. Peter corrected my error in
leaving out a never reached yield to make it so. My apologies. Putting if
False: yield None as the first line in the functi
[EMAIL PROTECTED] wrote:
def mockit(): raise StopIteration
now pass mockit()
but it behaviors differenctly when pass in a mockit() and pass in an
iterator with empty. so i think the code emulates nothing.
Is it possible that what you really need is a generator function
instead of just a regular
> def mockit(): raise StopIteration
> now pass mockit()
but it behaviors differenctly when pass in a mockit() and pass in an
iterator with empty. so i think the code emulates nothing.
> def intit(k):
> for i in range(k): yield i
Now you mean define my own iteration without the help of pmock.
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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.
Why bother?
def mockit(): raise StopIteration
now pass mockit()
> Fo
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. B