From 9a849fe54eb97382131b4a0c66f5e09ff770612c Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Thu, 24 Oct 2019 16:16:27 +0200 Subject: [PATCH] Explicitly catch warning in test --- spacy/tests/pipeline/test_entity_linker.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/tests/pipeline/test_entity_linker.py b/spacy/tests/pipeline/test_entity_linker.py index bc76d1e47..8023f72a6 100644 --- a/spacy/tests/pipeline/test_entity_linker.py +++ b/spacy/tests/pipeline/test_entity_linker.py @@ -154,7 +154,8 @@ def test_append_alias(nlp): assert len(mykb.get_candidates("douglas")) == 3 # append the same alias-entity pair again should not work (will throw a warning) - mykb.append_alias(alias="douglas", entity="Q1", prior_prob=0.3) + with pytest.warns(UserWarning): + mykb.append_alias(alias="douglas", entity="Q1", prior_prob=0.3) # test the size of the relevant candidates remained unchanged assert len(mykb.get_candidates("douglas")) == 3