def _test_execute( self, type, testcontent, count, ref='', cfunc=None ) : # Initialising the parser etparser = ETParser( lex_optimize=True, yacc_optimize=False ) # The first character is forced to be a `A` to avoid having `@` as the # first character testcontent = 'A' + testcontent # Characterize the generated testcontent set the wikiproperties wikiprops = {} testcontent = ( "@ %s " % wikiprops ) + '\n' + testcontent # Test by comparing the dumps try : tu = etparser.parse( testcontent, debuglevel=0 ) result = tu.dump()[:-1] except : tu = etparser.parse( testcontent, debuglevel=2 ) result = tu.dump()[:-1] # The reference is computed if no compare function (cfunc) is passed. if cfunc : cfunc( ref, tu ) else : ref = ref or testcontent ref = etparser._wiki_preprocess( ref ) props, ref = wiki_properties( ref ) if result != ref : print ''.join(diff.ndiff( result.splitlines(1), ref.splitlines(1) )) assert result == ref, type+'... testcount %s'%count
def _test_execute(self, type, testcontent, count, ref="", cfunc=None): # Initialising the parser etparser = ETParser(lex_optimize=True, yacc_optimize=False) # The first character is forced to be a `A` to avoid having `@` as the # first character testcontent = "A" + testcontent # Characterize the generated testcontent set the wikiproperties wikiprops = {} testcontent = ("@ %s " % wikiprops) + "\n" + testcontent # Test by comparing the dumps try: tu = etparser.parse(testcontent, debuglevel=0) result = tu.dump()[:-1] except: tu = etparser.parse(testcontent, debuglevel=2) result = tu.dump()[:-1] # The reference is computed if no compare function (cfunc) is passed. if cfunc: cfunc(ref, tu) else: ref = ref or testcontent ref = etparser._wiki_preprocess(ref) props, ref = wiki_properties(ref) if result != ref: print "".join(diff.ndiff(result.splitlines(1), ref.splitlines(1))) assert result == ref, type + "... testcount %s" % count
def _test_execute(self, type, testcontent, count, ref=''): # Initialising the parser etparser = ETParser(lex_optimize=True, yacc_optimize=False) # The first character is forced to be a `A` to avoid having `@` as the # first character testcontent = 'A' + testcontent # Prepare the reference. ref = ref or testcontent ref = etparser._wiki_preprocess(ref) props, ref = wiki_properties(ref) # Characterize the generated testcontent set the wikiproperties wikiprops = {} testcontent = ("@ %s " % wikiprops) + '\n' + testcontent # Test by comparing the dumps try: tu = etparser.parse(testcontent, debuglevel=0) result = tu.dump()[:-1] except: # open( 'testcontent', 'w' ).write( testcontent ) tu = etparser.parse(testcontent, debuglevel=2) result = tu.dump()[:-1] if result != ref: # open( 'result', 'w' ).write( result ) # open( 'ref', 'w' ).write( ref ) print ''.join(diff.ndiff(result.splitlines(1), ref.splitlines(1))) assert result == ref, type + '... testcount %s' % count
def _test_execute( self, type, testcontent, count, ref='' ) : # Initialising the parser etparser = ETParser( lex_optimize=True, yacc_optimize=False ) # The first character is forced to be a `A` to avoid having `@` as the # first character testcontent = 'A' + testcontent # Prepare the reference. ref = ref or testcontent ref = etparser._wiki_preprocess( ref ) props, ref = wiki_properties( ref ) # Characterize the generated testcontent set the wikiproperties wikiprops = {} testcontent = ( "@ %s " % wikiprops ) + '\n' + testcontent # Test by comparing the dumps try : tu = etparser.parse( testcontent, debuglevel=0 ) result = tu.dump()[:-1] except : # open( 'testcontent', 'w' ).write( testcontent ) tu = etparser.parse( testcontent, debuglevel=2 ) result = tu.dump()[:-1] if result != ref : # open( 'result', 'w' ).write( result ) # open( 'ref', 'w' ).write( ref ) print ''.join(diff.ndiff( result.splitlines(1), ref.splitlines(1) )) assert result == ref, type+'... testcount %s'%count