Example #1
0
 def testBadParser(self):
     self.fill_file(".xml", """<?xml version="1.0"?>
         <foo><bar>baz</bar></foo>
     """)
     # the generated file is not claimed
     f = open(self.filename)
     assert XmlParser.claims_for_parse(f) > 0
     f.close()
     self.assertRaises(ParserError, Package, self.filename)
Example #2
0
 def testForceParser(self):
     self.fill_file(".foo", """<?xml version="1.0"?>
         <foo><bar>baz</bar></foo>
     """)
     # the generated file is not claimed
     f = open(self.filename)
     assert XmlParser.claims_for_parse(f) == 0
     assert ZipParser.claims_for_parse(f) == 0
     f.close()
     self.assertRaises(NoClaimingError, Package, self.filename)
     self.assertRaises(ParserError, Package, self.filename, parser=XmlParser)
     self.assertRaises(BadZipfile, Package, self.filename, parser=ZipParser)
Example #3
0
 def __init__(self, file_, package):
     _AdveneXmlParser.__init__(self, file_, package)