Module pyparsing :: Class pyparsing_test :: Class TestParseResultsAsserts
[hide private]
[frames] | no frames]

Class TestParseResultsAsserts

source code

A mixin class to add parse results assertion methods to normal unittest.TestCase classes.

Instance Methods [hide private]
 
assertParseResultsEquals(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.
source code
 
assertParseAndCheckList(self, expr, test_string, expected_list, msg=None, verbose=True)
Convenience wrapper assert to test a parser element and input string, and assert that the resulting ParseResults.asList() is equal to the expected_list.
source code
 
assertParseAndCheckDict(self, expr, test_string, expected_dict, msg=None, verbose=True)
Convenience wrapper assert to test a parser element and input string, and assert that the resulting ParseResults.asDict() is equal to the expected_dict.
source code
 
assertRunTestResults(self, run_tests_report, expected_parse_results=None, msg=None)
Unit test assertion to evaluate output of ParserElement.runTests().
source code
 
assertRaisesParseException(*args, **kwds) source code
Method Details [hide private]

assertRunTestResults(self, run_tests_report, expected_parse_results=None, msg=None)

source code 

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)]

assertRaisesParseException(*args, **kwds)

source code 
Decorators:
  • @contextmanager