
import itertools
import utils


def compare_documents(feed):
    """
    Compare a list of documents by pair.
    """
    duplicates = []
    for pair in itertools.combinations(feed.articles, 2):
        if pair[0].content != "" and pair[0].content == pair[1].content:
            duplicates.append(pair)
    return duplicates

import itertools
import utils


def compare_documents(feed):
    """
    Compare a list of documents by pair.
    """
    duplicates = []
    for pair in itertools.combinations(feed.articles, 2):
        if pair[0].content != "" and \
            (utils.clear_string(pair[0].title) == utils.clear_string(pair[1].title) or \
            utils.clear_string(pair[0].content) == utils.clear_string(pair[1].content)):
            duplicates.append(pair)
    return duplicates
Test the equality of the contents and of the titles.
Test the equality of the contents and of the titles.

  
  import itertools
  import utils
  
  
  def compare_documents(feed):
      """
      Compare a list of documents by pair.
      """
      duplicates = []
      for pair in itertools.combinations(feed.articles, 2):
-         if pair[0].content != "" and pair[0].content == pair[1].content:
+         if pair[0].content != "" and \
+             (utils.clear_string(pair[0].title) == utils.clear_string(pair[1].title) or \
+             utils.clear_string(pair[0].content) == utils.clear_string(pair[1].content)):
              duplicates.append(pair)
      return duplicates
Test the equality of the contents and of the titles.
## Code Before:

import itertools
import utils


def compare_documents(feed):
    """
    Compare a list of documents by pair.
    """
    duplicates = []
    for pair in itertools.combinations(feed.articles, 2):
        if pair[0].content != "" and pair[0].content == pair[1].content:
            duplicates.append(pair)
    return duplicates
## Instruction:
Test the equality of the contents and of the titles.
## Code After:

import itertools
import utils


def compare_documents(feed):
    """
    Compare a list of documents by pair.
    """
    duplicates = []
    for pair in itertools.combinations(feed.articles, 2):
        if pair[0].content != "" and \
            (utils.clear_string(pair[0].title) == utils.clear_string(pair[1].title) or \
            utils.clear_string(pair[0].content) == utils.clear_string(pair[1].content)):
            duplicates.append(pair)
    return duplicates