def assert_has_n_elements_with_path(output, path, n):
 xml = to_xml(output)
 n = int(n)
 num_elements = len(xml.findall(path))
 if (num_elements != n):
  errmsg = ('Expected to find %d elements with path %s, but %d were found.' % (n, path, num_elements))
  raise AssertionError(errmsg)

def assert_has_n_elements_with_path ( output , path , n ) : xml = to_xml ( output ) n = int ( n ) num_elements = len ( xml . findall ( path ) ) if ( num_elements != n ) : errmsg = ( 'Expected to find %d elements with path %s, but %d were found.' % ( n , path , num_elements ) ) raise AssertionError ( errmsg )
asserts the specified output has exactly n elements matching the path specified .