Skip to content

Commit

Permalink
add feature check in test_to_document_type_function
Browse files Browse the repository at this point in the history
  • Loading branch information
RainbowRivey committed Sep 30, 2024
1 parent 04a0418 commit c5ca512
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/unit/core/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,18 @@ def test_register_document_converter_mapping(dataset_with_converter_mapping):


def test_to_document_type_function(dataset_with_converter_functions):
assert set(dataset_with_converter_functions.features) == {
"entities",
"relations",
"metadata",
"sentences",
"id",
"text",
}
assert dataset_with_converter_functions.document_type == TestDocument
converted_dataset = dataset_with_converter_functions.to_document_type(TestDocumentWithLabel)
assert converted_dataset.document_type == TestDocumentWithLabel
assert set(converted_dataset.features) == {"id", "label", "metadata", "text"}

assert len(converted_dataset.document_converters) == 0
for doc in converted_dataset:
Expand Down

0 comments on commit c5ca512

Please sign in to comment.