test_qrcode.py 文件源码

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

项目:workflows.kyoyue 作者: wizyoung 项目源码 文件源码
def test_print_tty(self):
        qr = qrcode.QRCode()
        f = six.StringIO()
        f.isatty = lambda: True
        qr.print_tty(out=f)
        printed = f.getvalue()
        f.close()
        BOLD_WHITE_BG = '\x1b[1;47m'
        BLACK_BG = '\x1b[40m'
        WHITE_BLOCK = BOLD_WHITE_BG + '  ' + BLACK_BG
        EOL = '\x1b[0m\n'
        expected = (
            BOLD_WHITE_BG + '  '*23 + EOL +
            WHITE_BLOCK + '  '*7 + WHITE_BLOCK)
        self.assertEqual(printed[:len(expected)], expected)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号