def test_homographs(self): return corpus = Corpus('test') for w in self.homograph_info: corpus.add_word(Word(**w)) #Error, should find return an iterable of homographs? self.assertEqual([x.spelling for x in corpus.find('a')], ['a', 'a'])
def test_homographs(self): return corpus = Corpus('test') for w in self.homograph_info: corpus.add_word(Word(**w)) #Error, should find return an iterable of homographs? self.assertEqual([x.spelling for x in corpus.find('a')],['a','a'])
def test_basic(self): corpus = Corpus('test') for w in self.basic_info: self.assertRaises(KeyError,corpus.find,w['spelling'],True) corpus.add_word(Word(**w)) self.assertEqual(corpus[w['spelling']],Word(**w)) self.assertEqual(corpus.find(w['spelling']),Word(**w)) self.assertTrue(w['spelling'] in corpus) self.assertEqual(corpus.inventory._data,{'#':Segment('#'), 'a':Segment('a'), 'b':Segment('b'), 'c':Segment('c'), 'd':Segment('d')})
def test_basic(self): corpus = Corpus('test') for w in self.basic_info: self.assertRaises(KeyError, corpus.find, w['spelling'], True) corpus.add_word(Word(**w)) self.assertEqual(corpus[w['spelling']], Word(**w)) self.assertEqual(corpus.find(w['spelling']), Word(**w)) self.assertTrue(w['spelling'] in corpus) self.assertEqual( corpus.inventory._data, { '#': Segment('#'), 'a': Segment('a'), 'b': Segment('b'), 'c': Segment('c'), 'd': Segment('d') })