summaryrefslogtreecommitdiff
path: root/pyparsing/testing.py
diff options
context:
space:
mode:
authorMatt Carmody <33763384+mattcarmody@users.noreply.github.com>2020-03-29 20:14:56 +0000
committerGitHub <noreply@github.com>2020-03-29 15:14:56 -0500
commit96fe2688898c1846ea97e2039659b98ed6f71e4e (patch)
tree00dfca9a93defb22687ae2d2a44664347cdceed8 /pyparsing/testing.py
parent963a6245194692440dc3396b254925738405531f (diff)
downloadpyparsing-git-96fe2688898c1846ea97e2039659b98ed6f71e4e.tar.gz
Docstring formatting changes (#197)
* Tidy docstring formatting for lists and example codeblock * Add class references and formatting to docstrings * Experimental docstring formatting changes
Diffstat (limited to 'pyparsing/testing.py')
-rw-r--r--pyparsing/testing.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/pyparsing/testing.py b/pyparsing/testing.py
index 756d500..d924793 100644
--- a/pyparsing/testing.py
+++ b/pyparsing/testing.py
@@ -25,7 +25,8 @@ class pyparsing_test:
- literal string auto-conversion class
- __diag__ settings
- Example:
+ Example::
+
with reset_pyparsing_context():
# test that literals used to construct a grammar are automatically suppressed
ParserElement.inlineLiteralsUsing(Suppress)
@@ -92,8 +93,8 @@ class pyparsing_test:
self, result, expected_list=None, expected_dict=None, msg=None
):
"""
- Unit test assertion to compare a ParseResults object with an optional expected_list,
- and compare any defined results names with an optional expected_dict.
+ Unit test assertion to compare a :class:`ParseResults` object with an optional ``expected_list``,
+ and compare any defined results names with an optional ``expected_dict``.
"""
if expected_list is not None:
self.assertEqual(expected_list, result.asList(), msg=msg)
@@ -105,7 +106,7 @@ class pyparsing_test:
):
"""
Convenience wrapper assert to test a parser element and input string, and assert that
- the resulting ParseResults.asList() is equal to the expected_list.
+ the resulting ``ParseResults.asList()`` is equal to the ``expected_list``.
"""
result = expr.parseString(test_string, parseAll=True)
if verbose:
@@ -117,7 +118,7 @@ class pyparsing_test:
):
"""
Convenience wrapper assert to test a parser element and input string, and assert that
- the resulting ParseResults.asDict() is equal to the expected_dict.
+ the resulting ``ParseResults.asDict()`` is equal to the ``expected_dict``.
"""
result = expr.parseString(test_string, parseAll=True)
if verbose:
@@ -128,10 +129,10 @@ class pyparsing_test:
self, run_tests_report, expected_parse_results=None, msg=None
):
"""
- Unit test assertion to evaluate output of ParserElement.runTests(). If a list of
- list-dict tuples is given as the expected_parse_results argument, then these are zipped
- with the report tuples returned by runTests and evaluated using assertParseResultsEquals.
- Finally, asserts that the overall runTests() success value is True.
+ Unit test assertion to evaluate output of ``ParserElement.runTests()``. If a list of
+ list-dict tuples is given as the ``expected_parse_results`` argument, then these are zipped
+ with the report tuples returned by ``runTests`` and evaluated using ``assertParseResultsEquals``.
+ Finally, asserts that the overall ``runTests()`` success value is ``True``.
:param run_tests_report: tuple(bool, [tuple(str, ParseResults or Exception)]) returned from runTests
:param expected_parse_results (optional): [tuple(str, list, dict, Exception)]