コード例 #1
0
    def test_discard_stdout(self):
        """This method is not programatically testable,

        But will produce no expected output
        If it fails it becomes noticable at command line
        """
        # pylint: disable=no-self-use
        with swallow_stdout():
            print 'hello'
コード例 #2
0
 def test_swallow_stdout(self):
     stream = StringIO()
     with swallow_stdout(stream):
         print 'hello',
     self.assertEqual(stream.getvalue(), 'hello')