mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
avoid the tests interacting with eachother through the global Underscore variable
This commit is contained in:
parent
7939c63886
commit
6e717c62ed
|
@ -3,11 +3,17 @@ from __future__ import unicode_literals
|
|||
|
||||
from spacy.lang.en import English
|
||||
from spacy.pipeline import EntityRuler
|
||||
from spacy.tokens.underscore import Underscore
|
||||
|
||||
|
||||
def test_issue4849():
|
||||
nlp = English()
|
||||
|
||||
# reset the Underscore object because test_underscore has a lambda function that can't be pickled
|
||||
Underscore.doc_extensions = {}
|
||||
Underscore.span_extensions = {}
|
||||
Underscore.token_extensions = {}
|
||||
|
||||
ruler = EntityRuler(
|
||||
nlp, patterns=[
|
||||
{"label": "PERSON", "pattern": 'joe biden', "id": 'joe-biden'},
|
||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||
import spacy
|
||||
from spacy.lang.en import English
|
||||
from spacy.tokens import Span, Doc
|
||||
from spacy.tokens.underscore import Underscore
|
||||
|
||||
|
||||
class CustomPipe:
|
||||
|
@ -31,6 +32,12 @@ class CustomPipe:
|
|||
|
||||
def test_issue4903():
|
||||
# ensures that this runs correctly and doesn't hang or crash on Windows / macOS
|
||||
|
||||
# reset the Underscore object because test_underscore has a lambda function that can't be pickled
|
||||
Underscore.doc_extensions = {}
|
||||
Underscore.span_extensions = {}
|
||||
Underscore.token_extensions = {}
|
||||
|
||||
nlp = English()
|
||||
custom_component = CustomPipe()
|
||||
nlp.add_pipe(nlp.create_pipe("sentencizer"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user