<s> from pyxl . codec . register import pyxl_decode <EOL> from pyxl . codec . tokenizer import PyxlParseError <EOL> from pyxl . codec . parser import ParseError <EOL> import os <EOL> error_cases_path = os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , <EOL> '<STR_LIT>' ) <EOL> def _expect_failure ( file_name ) : <EOL> path = os . path . join ( error_cases_path , file_name ) <EOL> try : <EOL> with open ( path ) as f : <EOL> print pyxl_decode ( f . read ( ) ) <EOL> assert False , "<STR_LIT>" % file_name <EOL> except ( PyxlParseError , ParseError ) : <EOL> pass <EOL> def test_error_cases ( ) : <EOL> cases = os . listdir ( error_cases_path ) <EOL> for file_name in cases : <EOL> if file_name . endswith ( "<STR_LIT>" ) : <EOL> yield ( _expect_failure , file_name ) </s>
