Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_pyexpat.InterningTest Class Reference

List of all members.

Public Member Functions

def test
def test_issue9402

Public Attributes

 parser
 parser_result

Detailed Description

Definition at line 263 of file test_pyexpat.py.


Member Function Documentation

Definition at line 264 of file test_pyexpat.py.

00264 
00265     def test(self):
00266         # Test the interning machinery.
00267         p = expat.ParserCreate()
00268         L = []
00269         def collector(name, *args):
00270             L.append(name)
00271         p.StartElementHandler = collector
00272         p.EndElementHandler = collector
00273         p.Parse("<e> <e/> <e></e> </e>", 1)
00274         tag = L[0]
00275         self.assertEqual(len(L), 6)
00276         for entry in L:
00277             # L should have the same string repeated over and over.
00278             self.assertTrue(tag is entry)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 279 of file test_pyexpat.py.

00279 
00280     def test_issue9402(self):
00281         # create an ExternalEntityParserCreate with buffer text
00282         class ExternalOutputter:
00283             def __init__(self, parser):
00284                 self.parser = parser
00285                 self.parser_result = None
00286 
00287             def ExternalEntityRefHandler(self, context, base, sysId, pubId):
00288                 external_parser = self.parser.ExternalEntityParserCreate("")
00289                 self.parser_result = external_parser.Parse("", 1)
00290                 return 1
00291 
00292         parser = expat.ParserCreate(namespace_separator='!')
00293         parser.buffer_text = 1
00294         out = ExternalOutputter(parser)
00295         parser.ExternalEntityRefHandler = out.ExternalEntityRefHandler
00296         parser.Parse(data, 1)
00297         self.assertEqual(out.parser_result, 1)
00298 

Here is the call graph for this function:


Member Data Documentation

Definition at line 283 of file test_pyexpat.py.

Definition at line 284 of file test_pyexpat.py.


The documentation for this class was generated from the following file: