eorg/tests/test_regex.py

38 lines
792 B
Python

import os
import re
import pytest
from eorg import const
from eorg.parser import parse
from eorg.generate import html
def test_example():
text="#+BEGIN_EXAMPLE"
rx = const.t_EXAMPLE_BEGIN
match = re.search(rx, text)
assert match is not None
text="#+BEGIN_EXAMPLE "
rx = const.t_EXAMPLE_BEGIN
match = re.search(rx, text)
assert match is not None
def test_source():
# invalid if no language specified
text="#+BEGIN_SRC"
rx = const.t_SRC_BEGIN
match = re.search(rx, text)
assert match is None
text="#+BEGIN_SRC "
rx = const.t_SRC_BEGIN
match = re.search(rx, text)
assert match is not None
text="#+BEGIN_SRC sh :results silent"
rx = const.t_SRC_BEGIN
match = re.search(rx, text)
assert match is not None