def test_add_two_filled_bows(self): filled_bow1 = BagOfWords("ala ma kota ala ma ala") filled_bow2 = BagOfWords("ala ala ala") merged_bow = filled_bow1.__add__(filled_bow2) self.assertEquals(6, merged_bow.__getitem__('ala')) self.assertEquals(2, merged_bow.__getitem__('ma')) self.assertEquals(1, merged_bow.__getitem__('kota'))
def test_add_empty_and_filled_bow(self): empty_bow = BagOfWords("") filled_bow = BagOfWords("ala ala ala") merged_bow = empty_bow.__add__(filled_bow) self.assertEquals(3, merged_bow.__getitem__('ala'))
def test_add_two_empty_bows(self): empty_bow1 = BagOfWords("") empty_bow2 = BagOfWords("") merged_bow = empty_bow1.__add__(empty_bow2) self.assertEquals([''], list(merged_bow.__iter__()))