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
This commit is contained in:
st81
2025-06-28 03:25:32 +09:00
committed by GitHub
parent 18143c76bf
commit a11f692895

View File

@@ -328,8 +328,10 @@ class TokenClassificationPipelineTests(unittest.TestCase):
self.assertEqual( self.assertEqual(
nested_simplify(output), 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": "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": "PER", "score": ANY(float), "word": "Wolfgang", "start": 11, "end": 19},
{"entity_group": "LOC", "score": ANY(float), "word": "Berlin", "start": 36, "end": 42}, {"entity_group": "LOC", "score": ANY(float), "word": "Berlin", "start": 34, "end": 40},
], ],
], ],
) )