<s> """<STR_LIT>""" <EOL> import unittest , sys , os . path <EOL> this_dir = os . path . dirname ( __file__ ) <EOL> if this_dir not in sys . path : <EOL> sys . path . insert ( <NUM_LIT:0> , this_dir ) <EOL> from common_imports import etree , HelperTestCase , fileInTestDir <EOL> from common_imports import doctest , make_doctest <EOL> class ETreeSchematronTestCase ( HelperTestCase ) : <EOL> def test_schematron ( self ) : <EOL> tree_valid = self . parse ( '<STR_LIT>' ) <EOL> tree_invalid = self . parse ( '<STR_LIT>' ) <EOL> schema = self . parse ( '''<STR_LIT>''' ) <EOL> schema = etree . Schematron ( schema ) <EOL> self . assertTrue ( schema . validate ( tree_valid ) ) <EOL> self . assertFalse ( schema . error_log . filter_from_errors ( ) ) <EOL> self . assertFalse ( schema . validate ( tree_invalid ) ) <EOL> self . assertTrue ( schema . error_log . filter_from_errors ( ) ) <EOL> self . assertTrue ( schema . validate ( tree_valid ) ) <EOL> self . assertFalse ( schema . error_log . filter_from_errors ( ) ) <EOL> def test_schematron_elementtree_error ( self ) : <EOL> self . assertRaises ( ValueError , etree . Schematron , etree . ElementTree ( ) ) <EOL> def test_schematron_invalid_schema ( self ) : <EOL> schema = self . parse ( '''<STR_LIT>''' ) <EOL> self . assertRaises ( etree . SchematronParseError , <EOL> etree . Schematron , schema ) <EOL> def test_schematron_invalid_schema_empty ( self ) : <EOL> schema = self . parse ( '''<STR_LIT>''' ) <EOL> self . assertRaises ( etree . SchematronParseError , <EOL> etree . Schematron , schema ) <EOL> def test_schematron_invalid_schema_namespace ( self ) : <EOL> schema = self . parse ( '''<STR_LIT>''' ) <EOL> self . assertRaises ( etree . SchematronParseError , <EOL> etree . Schematron , schema ) <EOL> def test_suite ( ) : <EOL> suite = unittest . TestSuite ( ) <EOL> suite . addTests ( [ unittest . makeSuite ( ETreeSchematronTestCase ) ] ) <EOL> suite . addTests ( <EOL> [ make_doctest ( '<STR_LIT>' ) ] ) <EOL> return suite <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> print ( '<STR_LIT>' % __file__ ) </s>
