mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
825 B
25 lines
825 B
import unittest
|
|
from unittest.mock import MagicMock
|
|
|
|
import pandas as pd
|
|
from pandas.testing import assert_frame_equal
|
|
|
|
from data_export.pipeline.dataset import Dataset
|
|
|
|
|
|
class TestDataset(unittest.TestCase):
|
|
def setUp(self):
|
|
example = MagicMock()
|
|
example.to_dict.return_value = {"data": "example"}
|
|
self.examples = MagicMock()
|
|
self.examples.__iter__.return_value = [example]
|
|
label = MagicMock()
|
|
label.find_by.return_value = {"labels": ["label"]}
|
|
self.labels = MagicMock()
|
|
self.labels.__iter__.return_value = [label]
|
|
|
|
def test_to_dataframe(self):
|
|
dataset = Dataset(self.examples, self.labels)
|
|
df = dataset.to_dataframe()
|
|
expected = pd.DataFrame([{"data": "example", "labels": ["label"]}])
|
|
assert_frame_equal(df, expected)
|