OpenQuizz
Une application de gestion des contenus pédagogiques
pyparsing_test.TestParseResultsAsserts Class Reference

Public Member Functions

def assertParseResultsEquals (self, result, expected_list=None, expected_dict=None, msg=None)
 
def assertParseAndCheckList (self, expr, test_string, expected_list, msg=None, verbose=True)
 
def assertParseAndCheckDict (self, expr, test_string, expected_dict, msg=None, verbose=True)
 
def assertRunTestResults (self, run_tests_report, expected_parse_results=None, msg=None)
 
def assertRaisesParseException (self, exc_type=ParseException, msg=None)
 

Detailed Description

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

Member Function Documentation

◆ assertParseAndCheckDict()

def 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.

◆ assertParseAndCheckList()

def 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.

◆ assertParseResultsEquals()

def 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.

◆ assertRaisesParseException()

def assertRaisesParseException (   self,
  exc_type = ParseException,
  msg = None 
)

◆ assertRunTestResults()

def assertRunTestResults (   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.

:param run_tests_report: tuple(bool, [tuple(str, ParseResults or Exception)]) returned from runTests
:param expected_parse_results (optional): [tuple(str, list, dict, Exception)]

The documentation for this class was generated from the following file: