| 1397 | assert_arrow_metadata_are_synced_with_dataset_features(dset_test_modifying_inputs_inplace) |
| 1398 | |
| 1399 | def test_map_nested(self, in_memory): |
| 1400 | with tempfile.TemporaryDirectory() as tmp_dir: |
| 1401 | with Dataset.from_dict({"field": ["a", "b"]}) as dset: |
| 1402 | with self._to(in_memory, tmp_dir, dset) as dset: |
| 1403 | with dset.map(lambda example: {"otherfield": {"capital": example["field"].capitalize()}}) as dset: |
| 1404 | with dset.map(lambda example: {"otherfield": {"append_x": example["field"] + "x"}}) as dset: |
| 1405 | self.assertEqual(dset[0], {"field": "a", "otherfield": {"append_x": "ax"}}) |
| 1406 | |
| 1407 | def test_map_return_example_as_dict_value(self, in_memory): |
| 1408 | with tempfile.TemporaryDirectory() as tmp_dir: |