|
|
@@ -60,6 +60,15 @@ class TestIndexing(unittest.TestCase): |
|
|
|
vocab.update(text) |
|
|
|
self.assertEqual(text, [vocab.to_word(idx) for idx in [vocab[w] for w in text]]) |
|
|
|
|
|
|
|
def test_iteration(self): |
|
|
|
vocab = Vocabulary() |
|
|
|
text = ["FastNLP", "works", "well", "in", "most", "cases", "and", "scales", "well", "in", |
|
|
|
"works", "well", "in", "most", "cases", "scales", "well"] |
|
|
|
vocab.update(text) |
|
|
|
text = set(text) |
|
|
|
for word in vocab: |
|
|
|
self.assertTrue(word in text) |
|
|
|
|
|
|
|
|
|
|
|
class TestOther(unittest.TestCase): |
|
|
|
def test_additional_update(self): |
|
|
|