()
| 232 | |
| 233 | |
| 234 | def test_print_tty(): |
| 235 | qr = qrcode.QRCode() |
| 236 | f = io.StringIO() |
| 237 | f.isatty = lambda: True |
| 238 | qr.print_tty(out=f) |
| 239 | printed = f.getvalue() |
| 240 | f.close() |
| 241 | BOLD_WHITE_BG = "\x1b[1;47m" |
| 242 | BLACK_BG = "\x1b[40m" |
| 243 | WHITE_BLOCK = BOLD_WHITE_BG + " " + BLACK_BG |
| 244 | EOL = "\x1b[0m\n" |
| 245 | expected = BOLD_WHITE_BG + " " * 23 + EOL + WHITE_BLOCK + " " * 7 + WHITE_BLOCK |
| 246 | assert printed[: len(expected)] == expected |
| 247 | |
| 248 | |
| 249 | def test_get_matrix(): |