2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

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
from DHParser.error import Error
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 typing import AbstractSet, Any, ByteString, Callable, cast, Container, Dict, \
Tuple, List, Sequence, Union, Text, Generic
......@@ -669,7 +669,7 @@ def collapse_if(context: List[Node], condition: Callable, target_tag: ParserBase
>>> text = MockParser('text')
>>> collapse_if([tree], not_one_of({'superscript', 'subscript'}), text)
>>> 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.
"""
......
......@@ -38,8 +38,10 @@ if __name__ == "__main__":
os.chdir('..')
files = os.listdir('DHParser')
for filename in files:
if filename.endswith('.py'):
print('\nDOCTESTS in ' + filename)
os.system(interpreter + ' -m doctest ' + filename)
if filename.endswith('.py') and filename \
not in ["foreign_typing.py", "stringview.py", "__init__.py"]:
filepath = os.path.join('DHParser', filename)
print('\nDOCTESTS in ' + filepath)
os.system(interpreter + ' -m doctest ' + filepath)
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