title: testing errors: comparing 2 files
body: <p>I have 5 functions working relatively</p>
  
  <p>1- singleline_diff(line1, line2)</p>
  
  <h1>comparing 2 line in one file</h1>
  
  <p>Inputs:
        line1 - first single line string
        line2 - second single line string
      Output:
        the index of the first difference between the two lines
        identical if the two lines are the same.</p>
  
  <p>2- singleline_diff_format(line1, line2, idx):</p>
  
  <h1>comparing 2 line in one file</h1>
  
  <p>Inputs:
        line1 - first single line string
        line2 - second single line string
        idx   - index at which to indicate difference (from 1st function)
      Output:
        abcd (first line)
        ==^  (= indicate identical character, ^ indicate the difference)
        abef (second line)</p>
  
  <pre><code>  If either input line contains a newline or carriage return, 
    then returns an empty string.
    If idx is not a valid index, then returns an empty string.
  </code></pre>
  
  <p>3- multiline_diff(lines1, lines2):</p>
  
  <h1>deal with two lists of lines</h1>
  
  <p>Inputs:
        lines1 - list of single line strings
        lines2 - list of single line strings
      Output:
        a tuple containing the line number (starting from 0) and
        the index in that line where the first difference between lines1
        and lines2 occurs.
        Returns (IDENTICAL, IDENTICAL) if the two lists are the same.</p>
  
  <p>4-get_file_lines(filename)
      Inputs:
        filename - name of file to read
      Output:
        a list of lines from the file named filename. 
        If the file does not exist or is not readable, then the
        behavior of this function is undefined.</p>
  
  <p>5- file_diff_format(filename1, filename2) " the function with the problem"</p>
  
  <h1>deals with two input files</h1>
  
  <p>Inputs:
        filename1 - name of first file
        filename2 - name of second file
      Output:
        four line string showing the location of the first
        difference between the two files named by the inputs.</p>
  
  <pre><code>  If the files are identical, the function instead returns the
    string "No differences\n".
  
    If either file does not exist or is not readable, then the
    behavior of this function is undefined.
  </code></pre>
  
  <p>testing the function:
  everything goes will until it the test use one empty file 
  it gave me "list index out of range"</p>
  
  <p>this is the code I use</p>
  
  <pre><code>def file_diff_format(filename1, filename2):
  
      file_1 = get_file_lines(filename1)
      file_2 = get_file_lines(filename2)
      mli_dif = multiline_diff(file_1, file_2)
      min_lens = min(len(file_1), len(file_2))
  
  
      if mli_dif == (-1,-1) :
          return "No differences" "\n" 
  
      else:
          diff_line_indx = mli_dif[0]
          diff_str_indx = int (mli_dif[1])
          if len(file_1) &gt;= 0:
              line_file_1 = ""
          else:
              line_file_1 = file_1[diff_line_indx]
  
          if len(file_2) &gt;= 0:
              line_file_2 = ""
          else:
              line_file_2 = file_2[diff_line_indx]
  
          line_file_1 = file_1[diff_line_indx]
          line_file_2 = file_2 [diff_line_indx]
  
          out_print = singleline_diff_format(line_file_1, line_file_2, diff_str_indx)
  
          return ( "Line {}{}{}".format ((diff_line_indx), (":\n"), (out_print)))
  </code></pre>