def testsearchandreplace():
 (document, docbody, relationships) = simpledoc()
 docbody = document.xpath('/w:document/w:body', namespaces=nsprefixes)[0]
 assert search(docbody, 'ing 1')
 assert search(docbody, 'ing 2')
 assert search(docbody, 'graph 3')
 assert search(docbody, 'ist Item')
 assert search(docbody, 'A1')
 if search(docbody, 'Paragraph 2'):
  docbody = replace(docbody, 'Paragraph 2', 'Whacko 55')
 assert search(docbody, 'Whacko 55')

def testsearchandreplace ( ) : ( document , docbody , relationships ) = simpledoc ( ) docbody = document . xpath ( '/w:document/w:body' , namespaces = nsprefixes ) [ 0 ] assert search ( docbody , 'ing 1' ) assert search ( docbody , 'ing 2' ) assert search ( docbody , 'graph 3' ) assert search ( docbody , 'ist Item' ) assert search ( docbody , 'A1' ) if search ( docbody , 'Paragraph 2' ) : docbody = replace ( docbody , 'Paragraph 2' , 'Whacko 55' ) assert search ( docbody , 'Whacko 55' )
ensure search and replace functions work .