test_pythonrc.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:pythonrc 作者: lonetwin 项目源码 文件源码
def test_pprint_compact(self):
        with patch('sys.stdout', new_callable=StringIO) as mock_stdout:

            # - test compact pprint-ing with 80x25 terminal
            with patch.object(pythonrc.subprocess, 'check_output',
                              return_value='25 80'):
                sys.displayhook(list(range(22)))
                self.assertIn('20, 21]', sys.stdout.getvalue())
                sys.displayhook(list(range(23)))
                self.assertIn('21,\n 22]', sys.stdout.getvalue())

            # - test compact pprint-ing with resized 100x25 terminal
            with patch.object(pythonrc.subprocess, 'check_output',
                              return_value=('25 100')):
                sys.displayhook(list(range(23)))
                self.assertIn('21, 22]', sys.stdout.getvalue())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号