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
|
# Tests for backwards compatibility
import json
from sybil.parsers.capture import parse_captures
from sybil.parsers.codeblock import CodeBlockParser, PythonCodeBlockParser
from sybil.parsers.skip import skip
from .helpers import parse
def test_imports():
# uncomment once all the moves are done!
from sybil.parsers.capture import parse_captures
from sybil.parsers.codeblock import CodeBlockParser, PythonCodeBlockParser
from sybil.parsers.doctest import DocTestParser
from sybil.parsers.skip import skip
pass
def test_code_block_parser_pad():
assert CodeBlockParser('foo').pad('x', line=2) == '\n\nx'
def test_skip_parser_function():
examples, namespace = parse('skip.txt', PythonCodeBlockParser(), skip, expected=9)
for example in examples:
example.evaluate()
assert namespace['run'] == [2, 5]
def test_capture_parser_function():
examples, namespace = parse('capture_codeblock.txt', parse_captures, expected=1)
examples[0].evaluate()
assert json.loads(namespace['json']) == {"a key": "value", "b key": 42}
|