<s> from lxml import etree <EOL> from six import binary_type , string_types <EOL> def assert_nodes_equal ( node_1 , node_2 ) : <EOL> parser = etree . XMLParser ( remove_blank_text = True ) <EOL> def _convert_node ( node ) : <EOL> if isinstance ( node , ( string_types , binary_type ) ) : <EOL> return etree . fromstring ( node , parser = parser ) <EOL> return node <EOL> text_1 = etree . tostring ( _convert_node ( node_1 ) , pretty_print = True ) <EOL> text_2 = etree . tostring ( _convert_node ( node_2 ) , pretty_print = True ) <EOL> assert text_1 == text_2 </s>
