Skip to content

Commit 99200c7

Browse files
committed
Remove redundant context manager in tests
1 parent a868d35 commit 99200c7

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

tests/test_arrow_dataset.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,15 +2041,14 @@ def test_task_with_incompatible_templates(self, in_memory):
20412041
data = {"input_text": ["i love transformers!"], "input_labels": [1]}
20422042
with tempfile.TemporaryDirectory() as tmp_dir, Dataset.from_dict(data, info=info) as dset:
20432043
with self._to(in_memory, tmp_dir, dset) as dset:
2044-
with self._to(in_memory, tmp_dir, dset) as dset:
2045-
with self.assertRaises(ValueError):
2046-
# Invalid task name
2047-
dset.prepare_for_task("this-task-does-not-exist")
2048-
# Duplicate task templates
2049-
dset.info.task_templates = [task, task]
2050-
dset.prepare_for_task("text-classification")
2051-
# Invalid task type
2052-
dset.prepare_for_task(1)
2044+
with self.assertRaises(ValueError):
2045+
# Invalid task name
2046+
dset.prepare_for_task("this-task-does-not-exist")
2047+
# Duplicate task templates
2048+
dset.info.task_templates = [task, task]
2049+
dset.prepare_for_task("text-classification")
2050+
# Invalid task type
2051+
dset.prepare_for_task(1)
20532052

20542053

20552054
class MiscellaneousDatasetTest(TestCase):

0 commit comments

Comments
 (0)