"Fredrik Lundh" <[EMAIL PROTECTED]> writes:
>>>
>>> why are you trying to reinvent doctest ?
>>
>> The OP asked for unit test. This could be read that
>> the OP wants to use module unittest.
>
> http://docs.python.org/lib/doctest-unittest-api.html
Ahh, that's good to know that doctests can be
"noro" wrote:
>> why are you trying to reinvent doctest ?
>
> it was my understanding that "doctest" is intented to test the little
> examples in a function/class documention, do people use it for more
> then that, i.e - do an extentive output testing for thier apps?
yes (by using doctest to test
Fredrik Lundh wrote:
> Scott David Daniels wrote:
>
> > For silly module myprog.py:
> > def A(s):
> > print '---'+s+'---'
> > in test_myprog.py:
> > import unittest
> > from cStringIO import StringIO # or from StringIO ...
>
> why are you trying to reinvent doctest ?
>
>
Marco Wahl wrote:
> Fredrik Lundh <[EMAIL PROTECTED]> writes:
>>
>> Scott David Daniels wrote:
>>
>>> For silly module myprog.py:
>>> def A(s):
>>> print '---'+s+'---'
>>> in test_myprog.py:
>>> import unittest
>>> from cStringIO import StringIO # or from StringIO ...
>>
> [OP] What is the proper way to test (using unit test) a method that print
> information?
> [...]
Fredrik Lundh <[EMAIL PROTECTED]> writes:
>
> Scott David Daniels wrote:
>
>> For silly module myprog.py:
>> def A(s):
>> print '---'+s+'---'
>> in test_myprog.py:
>> import unitte
At Monday 28/8/2006 12:59, Fredrik Lundh wrote:
> What is the proper way to test (using unit test) a method that print
> information?
> for example:
>
> def A(s):
> print '---'+s+'---'
>
> and i want to check that A("bla") really print out "---bla---"
http://docs.python.org/lib/module-
Scott David Daniels wrote:
> For silly module myprog.py:
> def A(s):
> print '---'+s+'---'
> in test_myprog.py:
> import unittest
> from cStringIO import StringIO # or from StringIO ...
why are you trying to reinvent doctest ?
--
http://mail.python.org/mailman/listin
noro wrote:
> What is the proper way to test (using unit test) a method that print
> information?
> for example:
>
> def A(s):
> print '---'+s+'---'
>
> and i want to check that A("bla") really print out "---bla---"
>
> thanks
> amit
>
For silly module myprog.py:
def A(s):
noro wrote:
> What is the proper way to test (using unit test) a method that print
> information?
> for example:
>
> def A(s):
> print '---'+s+'---'
>
> and i want to check that A("bla") really print out "---bla---"
You can replace sys.stdout with a cStringIO-object or any other
file-p
noro wrote:
> What is the proper way to test (using unit test) a method that print
> information?
> for example:
>
> def A(s):
> print '---'+s+'---'
>
> and i want to check that A("bla") really print out "---bla---"
http://docs.python.org/lib/module-doctest.html
--
http://mail.pyth
What is the proper way to test (using unit test) a method that print
information?
for example:
def A(s):
print '---'+s+'---'
and i want to check that A("bla") really print out "---bla---"
thanks
amit
--
http://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo