def test_bigrams_should_return_correct_score(self):
        # We need this list comprehension because we need to save the word list
        # in mongo (thus, it needs to be json serializable). Also, a list is
        # what will be available to the worker in real situations.
        tokens = [w for w in
                nltk.corpus.genesis.words('english-web.txt')]

        doc_id = self.collection.insert({'tokens': tokens}, w=1)

        Bigrams().delay(doc_id)
        refreshed_document = self.collection.find_one({'_id': doc_id})
        bigram_rank = refreshed_document['bigram_rank']
        result = bigram_rank[0][1][0]
        # This is the value of the chi_sq measure for this bigram in this
        # colocation
        expected_chi_sq = 95.59393417173634
        self.assertEqual(result, expected_chi_sq)