summaryrefslogtreecommitdiff
path: root/tests/blocks/test_table.py
blob: f33ea974ee1537f7bf65009065df36d240438772 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from asciidoc.blocks import table
import pytest


@pytest.mark.parametrize(
    "input,expected",
    (
        (None, (None, None)),
        ('', (None, None)),
        ('<', ('left', None)),
        ('^', ('center', None)),
        ('>', ('right', None)),
        ('.<', (None, 'top')),
        ('.^', (None, 'middle')),
        ('.>', (None, 'bottom')),
        ('<.<', ('left', 'top')),
        ('^.<', ('center', 'top')),
        ('>.<', ('right', 'top')),
        ('<.^', ('left', 'middle')),
        ('^.^', ('center', 'middle')),
        ('>.^', ('right', 'middle')),
        ('<.>', ('left', 'bottom')),
        ('^.>', ('center', 'bottom')),
        ('>.>', ('right', 'bottom')),
    )
)
def test_parse_align_spec(input, expected):
    assert table.parse_align_spec(input) == expected


@pytest.mark.parametrize(
    "input,expected",
    (
        (None, (1, 1)),
        ('', (1, 1)),
        ('0', (1, 1)),
        ('.0', (1, 1)),
        ('0.0', (1, 1)),
        ('2', (2, 1)),
        ('.2', (1, 2)),
        ('3.2', (3, 2)),
    )
)
def test_parse_table_span_spec(input, expected):
    assert table.parse_table_span_spec(input) == expected