2021-05-31 08:36:52 +00:00
|
|
|
import spacy
|
|
|
|
from spacy.lang.en import English
|
|
|
|
from ..util import make_tempdir
|
|
|
|
|
|
|
|
|
2021-11-05 01:27:19 +00:00
|
|
|
@pytest.mark.issue(8190)
|
2021-05-31 08:36:52 +00:00
|
|
|
def test_issue8190():
|
|
|
|
"""Test that config overrides are not lost after load is complete."""
|
|
|
|
source_cfg = {
|
|
|
|
"nlp": {
|
|
|
|
"lang": "en",
|
|
|
|
},
|
2021-06-28 09:48:00 +00:00
|
|
|
"custom": {"key": "value"},
|
2021-05-31 08:36:52 +00:00
|
|
|
}
|
|
|
|
source_nlp = English.from_config(source_cfg)
|
|
|
|
with make_tempdir() as dir_path:
|
|
|
|
# We need to create a loadable source pipeline
|
|
|
|
source_path = dir_path / "test_model"
|
|
|
|
source_nlp.to_disk(source_path)
|
2021-06-28 09:48:00 +00:00
|
|
|
nlp = spacy.load(source_path, config={"custom": {"key": "updated_value"}})
|
2021-05-31 08:36:52 +00:00
|
|
|
|
|
|
|
assert nlp.config["custom"]["key"] == "updated_value"
|