Debian Codegraph @

tests/t40_utf7.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2 import common
3 from common import setup_module, teardown_module
4
5 inputs = [
6 '\n',
7 'A+ImIDkQ.\n',
8 'Hi Mom +Jjo!\n',
9 '+ZeVnLIqe\n',
10 'Item 3 is +AKM-1.\n',
11 ]
12
13 outputs = [
14 '0xFEFF, 0x000A\n',
15 '0xFEFF, 0x0041, 0x2262, 0x0391, 0x002E, 0x000A\n',
16 ('0xFEFF, 0x0048, 0x0069, 0x0020, 0x004D, 0x006F, 0x006D, 0x0020,\n'
17 '0x263A, 0x0021, 0x000A\n'),
18 '0xFEFF, 0x65E5, 0x672C, 0x8A9E, 0x000A\n',
19 ('0xFEFF, 0x0049, 0x0074, 0x0065, 0x006D, 0x0020, 0x0033, 0x0020,\n'
20 '0x0069, 0x0073, 0x0020, 0x00A3, 0x0031, 0x002E, 0x000A\n')]
21
22 class Test:
23
24 def setup_method(self, method):
25 common.request('u7..u6/x2')
26
27 def test_1(self):
28 # Single lines from UTF-7.
29 for input, output in zip(inputs, outputs):
30 yield common.validate, input, output
31
32 def test_2(self):
33 # Single lines from UTF-7 and back.
34 for input in inputs:
35 yield common.validate_back, input
36
37 def test_3(self):
38 # All lines at once and back.
39 yield common.validate_back, ''.join(inputs)