diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/blocks/__init__.py | 0 | ||||
-rw-r--r-- | tests/blocks/test_table.py | 45 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/blocks/__init__.py b/tests/blocks/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/blocks/__init__.py diff --git a/tests/blocks/test_table.py b/tests/blocks/test_table.py new file mode 100644 index 0000000..f33ea97 --- /dev/null +++ b/tests/blocks/test_table.py @@ -0,0 +1,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 |