From a11f69289572955f4be9d2bc7b7c5dd949722fc1 Mon Sep 17 00:00:00 2001 From: st81 <58893365+st81@users.noreply.github.com> Date: Sat, 28 Jun 2025 03:25:32 +0900 Subject: [PATCH] Fixes the failing test `test_is_split_into_words` in `test_pipelines_token_classification.py` (#39079) * Fix test pipelines token classification for is_split_into_words * Fix incorrect import format --- tests/pipelines/test_pipelines_token_classification.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/pipelines/test_pipelines_token_classification.py b/tests/pipelines/test_pipelines_token_classification.py index 16767b342c8..c3c474be8db 100644 --- a/tests/pipelines/test_pipelines_token_classification.py +++ b/tests/pipelines/test_pipelines_token_classification.py @@ -328,8 +328,10 @@ class TokenClassificationPipelineTests(unittest.TestCase): self.assertEqual( nested_simplify(output), [ - {"entity_group": "PER", "score": ANY(float), "word": "Sarah", "start": 6, "end": 11}, - {"entity_group": "LOC", "score": ANY(float), "word": "New York", "start": 21, "end": 29}, + [ + {"entity_group": "PER", "score": ANY(float), "word": "Sarah", "start": 6, "end": 11}, + {"entity_group": "LOC", "score": ANY(float), "word": "New York", "start": 21, "end": 29}, + ] ], ) @@ -349,8 +351,8 @@ class TokenClassificationPipelineTests(unittest.TestCase): {"entity_group": "LOC", "score": ANY(float), "word": "New York", "start": 21, "end": 29}, ], [ - {"entity_group": "PER", "score": ANY(float), "word": "Wolfgang", "start": 12, "end": 20}, - {"entity_group": "LOC", "score": ANY(float), "word": "Berlin", "start": 36, "end": 42}, + {"entity_group": "PER", "score": ANY(float), "word": "Wolfgang", "start": 11, "end": 19}, + {"entity_group": "LOC", "score": ANY(float), "word": "Berlin", "start": 34, "end": 40}, ], ], )