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-doctest.html

When the output goes a bit more complicated, consider splitting such method in parts: some generate the output, others just print it. Then you can test the former using the standard unittest framework.



Gabriel Genellina
Softlab SRL

        
        
                
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! http://www.yahoo.com.ar/respuestas

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

Reply via email to