def test_debug_print(self): file_list = FileList() with captured_stdout() as stdout: file_list.debug_print('xxx') self.assertEqual(stdout.getvalue(), '') debug.DEBUG = True try: with captured_stdout() as stdout: file_list.debug_print('xxx') self.assertEqual(stdout.getvalue(), 'xxx\n') finally: debug.DEBUG = False
def test_debug_print(self): file_list = FileList() with captured_stdout() as stdout: file_list.debug_print("xxx") stdout.seek(0) self.assertEqual(stdout.read(), "") debug.DEBUG = True try: with captured_stdout() as stdout: file_list.debug_print("xxx") stdout.seek(0) self.assertEqual(stdout.read(), "xxx\n") finally: debug.DEBUG = False