Back to index

plone3  3.1.7
Private Member Functions
GenericSetup.tests.common.DOMComparator Class Reference
Inheritance diagram for GenericSetup.tests.common.DOMComparator:
Inheritance graph
[legend]

List of all members.

Private Member Functions

def _compareDOM

Detailed Description

Definition at line 32 of file common.py.


Member Function Documentation

def GenericSetup.tests.common.DOMComparator._compareDOM (   self,
  found_text,
  expected_text,
  debug = False 
) [private]

Definition at line 34 of file common.py.

00034 
00035     def _compareDOM( self, found_text, expected_text, debug=False ):
00036 
00037         found_lines = [ x.strip() for x in found_text.splitlines() ]
00038         found_text = '\n'.join( filter( None, found_lines ) )
00039 
00040         expected_lines = [ x.strip() for x in expected_text.splitlines() ]
00041         expected_text = '\n'.join( filter( None, expected_lines ) )
00042 
00043         from xml.dom.minidom import parseString
00044         found = parseString( found_text )
00045         expected = parseString( expected_text )
00046         fxml = found.toxml()
00047         exml = expected.toxml()
00048 
00049         if fxml != exml:
00050 
00051             if debug:
00052                 zipped = zip( fxml, exml )
00053                 diff = [ ( i, zipped[i][0], zipped[i][1] )
00054                         for i in range( len( zipped ) )
00055                         if zipped[i][0] != zipped[i][1]
00056                     ]
00057                 import pdb; pdb.set_trace()
00058 
00059             print 'Found:'
00060             print fxml
00061             print
00062             print 'Expected:'
00063             print exml
00064             print
00065 
00066         self.assertEqual( found.toxml(), expected.toxml() )
00067 


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