From a84762758809af8ee585a027699e9eb909528aaf Mon Sep 17 00:00:00 2001 From: svlandeg Date: Thu, 6 Jul 2023 12:26:26 +0200 Subject: [PATCH] add test case --- spacy/tests/pipeline/test_pipe_methods.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spacy/tests/pipeline/test_pipe_methods.py b/spacy/tests/pipeline/test_pipe_methods.py index 39611a742..4c0088804 100644 --- a/spacy/tests/pipeline/test_pipe_methods.py +++ b/spacy/tests/pipeline/test_pipe_methods.py @@ -189,6 +189,16 @@ def test_add_pipe_last(nlp, name1, name2): assert nlp.pipeline[-1][0] == name1 +@pytest.mark.parametrize("name1,name2", [("parser", "lambda_pipe")]) +def test_add_pipe_false(nlp, name1, name2): + Language.component("new_pipe2", func=lambda doc: doc) + nlp.add_pipe("new_pipe2", name=name2) + with pytest.raises(ValueError, match="The 'last' parameter should be 'None' or 'True', but found 'False'"): + nlp.add_pipe("new_pipe", name=name1, last=False) + with pytest.raises(ValueError, match="The 'first' parameter should be 'None' or 'True', but found 'False'"): + nlp.add_pipe("new_pipe", name=name1, first=False) + + def test_cant_add_pipe_first_and_last(nlp): with pytest.raises(ValueError): nlp.add_pipe("new_pipe", first=True, last=True)