Commit 41d7b210 authored by eckhart's avatar eckhart
Browse files

test/run.py now also runs all doctests

parent 9760c373
...@@ -34,7 +34,7 @@ from functools import partial, reduce, singledispatch ...@@ -34,7 +34,7 @@ from functools import partial, reduce, singledispatch
from DHParser.error import Error from DHParser.error import Error
from DHParser.syntaxtree import Node, WHITESPACE_PTYPE, TOKEN_PTYPE, ParserBase, MockParser, \ from DHParser.syntaxtree import Node, WHITESPACE_PTYPE, TOKEN_PTYPE, ParserBase, MockParser, \
ZOMBIE_NODE ZOMBIE_NODE, parse_sxpr, flatten_sxpr
from DHParser.toolkit import issubtype, isgenerictype, expand_table, smart_list, re, typing from DHParser.toolkit import issubtype, isgenerictype, expand_table, smart_list, re, typing
from typing import AbstractSet, Any, ByteString, Callable, cast, Container, Dict, \ from typing import AbstractSet, Any, ByteString, Callable, cast, Container, Dict, \
Tuple, List, Sequence, Union, Text, Generic Tuple, List, Sequence, Union, Text, Generic
...@@ -669,7 +669,7 @@ def collapse_if(context: List[Node], condition: Callable, target_tag: ParserBase ...@@ -669,7 +669,7 @@ def collapse_if(context: List[Node], condition: Callable, target_tag: ParserBase
>>> text = MockParser('text') >>> text = MockParser('text')
>>> collapse_if([tree], not_one_of({'superscript', 'subscript'}), text) >>> collapse_if([tree], not_one_of({'superscript', 'subscript'}), text)
>>> print(flatten_sxpr(tree.as_sxpr())) >>> print(flatten_sxpr(tree.as_sxpr()))
(place (text "p. 26") (superscript "b") (text ",18")) (place (text "p.26") (superscript "b") (text ",18"))
See `test_transform.TestComplexTransformations` for examples. See `test_transform.TestComplexTransformations` for examples.
""" """
......
...@@ -38,8 +38,10 @@ if __name__ == "__main__": ...@@ -38,8 +38,10 @@ if __name__ == "__main__":
os.chdir('..') os.chdir('..')
files = os.listdir('DHParser') files = os.listdir('DHParser')
for filename in files: for filename in files:
if filename.endswith('.py'): if filename.endswith('.py') and filename \
print('\nDOCTESTS in ' + filename) not in ["foreign_typing.py", "stringview.py", "__init__.py"]:
os.system(interpreter + ' -m doctest ' + filename) filepath = os.path.join('DHParser', filename)
print('\nDOCTESTS in ' + filepath)
os.system(interpreter + ' -m doctest ' + filepath)
os.chdir(cwd) os.chdir(cwd)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment