@@ -129,13 +129,27 @@ def test_enable_pipes_method(nlp, name):
129
129
130
130
@pytest .mark .parametrize ("name" , ["my_component" ])
131
131
def test_disable_pipes_context (nlp , name ):
132
+ """Test that an enabled component stays enabled after running the context manager."""
132
133
nlp .add_pipe ("new_pipe" , name = name )
133
134
assert nlp .has_pipe (name )
134
135
with nlp .select_pipes (disable = name ):
135
136
assert not nlp .has_pipe (name )
136
137
assert nlp .has_pipe (name )
137
138
138
139
140
+ @pytest .mark .parametrize ("name" , ["my_component" ])
141
+ def test_disable_pipes_context_restore (nlp , name ):
142
+ """Test that a disabled component stays disabled after running the context manager."""
143
+ nlp .add_pipe ("new_pipe" , name = name )
144
+ assert nlp .has_pipe (name )
145
+ nlp .disable_pipes (name )
146
+ assert not nlp .has_pipe (name )
147
+ with nlp .select_pipes (disable = name ):
148
+ assert not nlp .has_pipe (name )
149
+ assert not nlp .has_pipe (name )
150
+
151
+
152
+
139
153
def test_select_pipes_list_arg (nlp ):
140
154
for name in ["c1" , "c2" , "c3" ]:
141
155
nlp .add_pipe ("new_pipe" , name = name )
0 commit comments