@@ -132,6 +132,41 @@ def test_is_reasoning_end(self, test_tokenizer):
132132 is False
133133 )
134134
135+ def test_is_reasoning_end_streaming (self , test_tokenizer ):
136+ """Test the is_reasoning_end_streaming method."""
137+ parser = TestThinkingReasoningParser (test_tokenizer )
138+ end_token_id = parser .end_token_id
139+ start_token_id = parser .start_token_id
140+
141+ assert (
142+ parser .is_reasoning_end_streaming ([1 , 2 , end_token_id ], [end_token_id ])
143+ is True
144+ )
145+ assert parser .is_reasoning_end_streaming ([1 , 2 , 3 , 4 ], [4 ]) is False
146+ assert parser .is_reasoning_end_streaming ([], []) is False
147+ assert (
148+ parser .is_reasoning_end_streaming (
149+ [1 , start_token_id , 2 , end_token_id ], [end_token_id ]
150+ )
151+ is True
152+ )
153+ assert (
154+ parser .is_reasoning_end_streaming ([1 , start_token_id , 2 , 3 ], [3 ]) is False
155+ )
156+ assert (
157+ parser .is_reasoning_end_streaming (
158+ [1 , start_token_id , 2 , end_token_id , 2 , start_token_id ],
159+ [end_token_id , 2 , start_token_id ],
160+ )
161+ is False
162+ )
163+ assert (
164+ parser .is_reasoning_end_streaming (
165+ [1 , start_token_id , 2 , end_token_id , 2 , 2 ], [2 ]
166+ )
167+ is False
168+ )
169+
135170 def test_extract_content_ids (self , test_tokenizer ):
136171 """Test the extract_content_ids method."""
137172 parser = TestThinkingReasoningParser (test_tokenizer )
0 commit comments