@@ -0,0 +1,1648 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%0Afrom __future__ import (absolute_import, division,%0A                        print_function, unicode_literals)%0Afrom builtins import *%0A%0A%22%22%22%0Atest_corpus%0A----------------------------------%0A%0ATests for %60corpus%60 module.%0A%22%22%22%0A%0Aimport unittest%0A%0Afrom experiment import corpus as c%0A%0Aclass TextCorpus(unittest.TestCase):%0A    %0A    def setUp(self):%0A        self.corpus_a = c.Corpus(title='testing_a')%0A        self.corpus_b = c.Corpus(title='testing_b')%0A        self.sentences = %5B%5D%0A        for i in range(100):%0A            sentence = c.Sentence(str(i), i, 'doc'+str(i%2510))%0A            self.sentences.append(sentence)%0A            if i %3C 50:%0A                self.corpus_a.append(sentence)%0A            else:%0A                self.corpus_b.append(sentence)%0A        %0A    def test_init(self):%0A        self.assertEqual(self.corpus_a.title, 'testing_a')%0A        %0A    def test_add(self):%0A        result = self.corpus_a + self.corpus_b%0A        wanted = c.Corpus('testing_a%7Ctesting_b',%0A                            self.sentences)%0A        self.assertEqual(result, wanted)%0A        %0A    def test_doc_set(self):%0A        wanted = %7B'doc'+str(i) for i in range(10)%7D%0A        result = self.corpus_a.doc_set()%0A        self.assertEqual(result, wanted)%0A        %0A    def test_divide(self):%0A        corpus_list = self.corpus_a.divide(5)%0A        self.assertEqual(len(corpus_list), 5)%0A        for corpus in corpus_list:%0A            self.assertEqual(len(corpus), 10)%0A        result = sum(corpus_list, c.Corpus())%0A        result.title = 'testing_a'%0A        wanted = self.corpus_a%0A        self.assertEqual(set(result), set(wanted))%0A        %0A        

test for corpus