issue5230 added unit test for dumping and loading knowledgebase

This commit is contained in:
Leander Fiedler 2020-04-12 09:08:41 +02:00 committed by lfiedler
parent d2bb649227
commit d60e2d3ebf

View File

@ -115,6 +115,23 @@ def test_writer_with_path_py35():
writer.close() writer.close()
def test_save_and_load_knowledge_base():
nlp = Language()
kb = KnowledgeBase(nlp.vocab, entity_vector_length=1)
with make_tempdir() as d:
path = d / "kb"
try:
kb.dump(path)
except Exception as e:
pytest.fail(str(e))
try:
kb_loaded = KnowledgeBase(nlp.vocab, entity_vector_length=1)
kb_loaded.load_bulk(path)
except Exception as e:
pytest.fail(str(e))
class TestToDiskResourceWarningUnittest(TestCase): class TestToDiskResourceWarningUnittest(TestCase):
def test_resource_warning(self): def test_resource_warning(self):
scenarios = zip(*objects_to_test) scenarios = zip(*objects_to_test)