[go: up one dir, main page]

File: test_tolerant.py

package info (click to toggle)
luma.core 2.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,040 kB
  • sloc: python: 6,186; makefile: 204
file content (25 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014-18 Richard Hull and contributors
# See LICENSE.rst for details.


from luma.core.legacy.font import proportional, tolerant, CP437_FONT


def test_default():
    font = tolerant(CP437_FONT)
    assert font[65] == [0x7C, 0x7E, 0x13, 0x13, 0x7E, 0x7C, 0x00, 0x00]
    assert font[6543] == [0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80]


def test_custom_missing():
    font = tolerant(CP437_FONT, missing="?")
    assert font[65] == [0x7C, 0x7E, 0x13, 0x13, 0x7E, 0x7C, 0x00, 0x00]
    assert font[6543] == [0x02, 0x03, 0x51, 0x59, 0x0F, 0x06, 0x00, 0x00]


def test_with_proportional():
    font = proportional(tolerant(CP437_FONT, missing="?"))
    assert font[65] == [0x7C, 0x7E, 0x13, 0x13, 0x7E, 0x7C, 0x00]
    assert font[6543] == [0x02, 0x03, 0x51, 0x59, 0x0F, 0x06, 0x00]