<s> import os <EOL> import re <EOL> import mistune <EOL> root = os . path . dirname ( __file__ ) <EOL> known = [ ] <EOL> m = mistune . Markdown ( ) <EOL> def render ( folder , name ) : <EOL> filepath = os . path . join ( folder , name + '<STR_LIT>' ) <EOL> with open ( filepath ) as f : <EOL> content = f . read ( ) <EOL> html = m . parse ( content ) <EOL> filepath = os . path . join ( folder , name + '<STR_LIT>' ) <EOL> with open ( filepath ) as f : <EOL> result = f . read ( ) <EOL> html = re . sub ( r'<STR_LIT>' , '<STR_LIT>' , html ) <EOL> result = re . sub ( r'<STR_LIT>' , '<STR_LIT>' , result ) <EOL> for i , s in enumerate ( html ) : <EOL> if s != result [ i ] : <EOL> begin = max ( i - <NUM_LIT:30> , <NUM_LIT:0> ) <EOL> msg = '<STR_LIT>' % ( <EOL> html [ begin : i + <NUM_LIT:30> ] , i , result [ begin : i + <NUM_LIT:30> ] <EOL> ) <EOL> raise ValueError ( msg ) <EOL> assert html == result <EOL> def listdir ( folder ) : <EOL> folder = os . path . join ( root , '<STR_LIT>' , folder ) <EOL> files = os . listdir ( folder ) <EOL> files = filter ( lambda o : o . endswith ( '<STR_LIT>' ) , files ) <EOL> names = map ( lambda o : o [ : - <NUM_LIT:5> ] , files ) <EOL> return folder , names <EOL> def test_extra ( ) : <EOL> folder , names = listdir ( '<STR_LIT>' ) <EOL> for key in names : <EOL> yield render , folder , key <EOL> def test_normal ( ) : <EOL> folder , names = listdir ( '<STR_LIT>' ) <EOL> for key in names : <EOL> yield render , folder , key </s>
