From: Ryan Davis Date: 2007-10-24T22:42:52+09:00 Subject: Re: Unit Testing, how to use assert_equal for last printed line? On Oct 24, 2007, at 01:30 , Feng Tien wrote: > How do I write an assertion so it tests if, say the last line > printed is > equal to the expected? Lasts just say the program asks for 2 numbers, > and outputs all the number from the lowest to the highest. The easiest way to do it is to store off stdout and replace it with a StringIO and test against that. Replace stdout in teardown.