Back to index

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

List of all members.

Public Member Functions

def StartElementHandler
def EndElementHandler
def check_pos
def test

Public Attributes

 parser
 upto
 expected_list

Detailed Description

Definition at line 412 of file test_pyexpat.py.


Member Function Documentation

def test.test_pyexpat.PositionTest.check_pos (   self,
  event 
)

Definition at line 419 of file test_pyexpat.py.

00419 
00420     def check_pos(self, event):
00421         pos = (event,
00422                self.parser.CurrentByteIndex,
00423                self.parser.CurrentLineNumber,
00424                self.parser.CurrentColumnNumber)
00425         self.assertTrue(self.upto < len(self.expected_list),
00426                         'too many parser events')
00427         expected = self.expected_list[self.upto]
00428         self.assertEqual(pos, expected,
00429                 'Expected position %s, got position %s' %(pos, expected))
00430         self.upto += 1

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 416 of file test_pyexpat.py.

00416 
00417     def EndElementHandler(self, name):
00418         self.check_pos('e')

Here is the call graph for this function:

def test.test_pyexpat.PositionTest.StartElementHandler (   self,
  name,
  attrs 
)

Definition at line 413 of file test_pyexpat.py.

00413 
00414     def StartElementHandler(self, name, attrs):
00415         self.check_pos('s')

Here is the call graph for this function:

Definition at line 431 of file test_pyexpat.py.

00431 
00432     def test(self):
00433         self.parser = expat.ParserCreate()
00434         self.parser.StartElementHandler = self.StartElementHandler
00435         self.parser.EndElementHandler = self.EndElementHandler
00436         self.upto = 0
00437         self.expected_list = [('s', 0, 1, 0), ('s', 5, 2, 1), ('s', 11, 3, 2),
00438                               ('e', 15, 3, 6), ('e', 17, 4, 1), ('e', 22, 5, 0)]
00439 
00440         xml = '<a>\n <b>\n  <c/>\n </b>\n</a>'
00441         self.parser.Parse(xml, 1)
00442 

Here is the caller graph for this function:


Member Data Documentation

Definition at line 436 of file test_pyexpat.py.

Definition at line 432 of file test_pyexpat.py.

Definition at line 435 of file test_pyexpat.py.


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