MCPcopy
hub / github.com/explosion/spaCy / test_applycli_user_data

Function test_applycli_user_data

spacy/tests/test_cli.py:1007–1020  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1005
1006
1007def test_applycli_user_data():
1008 Doc.set_extension("ext", default=0)
1009 val = ("ext", 0)
1010 with make_tempdir() as data_path:
1011 output = data_path / "testout.spacy"
1012 nlp = spacy.blank("en")
1013 doc = nlp("testing apply cli.")
1014 doc._.ext = val
1015 docbin = DocBin(store_user_data=True)
1016 docbin.add(doc)
1017 docbin.to_disk(data_path / "testin.spacy")
1018 apply(data_path, output, "blank:en", "", 1, 1)
1019 result = list(DocBin().from_disk(output).get_docs(nlp.vocab))
1020 assert result[0]._.ext == val
1021
1022
1023def test_cli_find_threshold(capsys):

Callers

nothing calls this directly

Calls 8

addMethod · 0.95
to_diskMethod · 0.95
DocBinClass · 0.90
applyFunction · 0.90
make_tempdirFunction · 0.85
get_docsMethod · 0.80
nlpFunction · 0.70
from_diskMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…