code: def test_update_feedback_dataset(
      td_extractor: TextDescriptivesExtractor,
  ):
      dataset = FeedbackDataset(
          fields=[TextField(name="text")],
          questions=[TextQuestion(name="question")],
      )
      records = [
          FeedbackRecord(fields={"text": "This is a test."}),
          FeedbackRecord(fields={"text": "This is another test."}),
      ]
      dataset.add_records(records)
  
      extracted_metrics = pd.DataFrame({"text_n_tokens": [4, 5]})
      td_extractor._extract_metrics_for_all_fields = MagicMock(
          return_value=extracted_metrics
      )
      td_extractor._cast_to_python_types = MagicMock(
          return_value=extracted_metrics
      )
      td_extractor._clean_column_name = MagicMock(
          side_effect=lambda col: col
      )
      td_extractor._create_metadata_properties = MagicMock(
          return_value=[IntegerMetadataProperty(name="text_n_tokens")]
      )
  
      updated_dataset = td_extractor.update_dataset(
          dataset, update_records=False
      )
  
      td_extractor._extract_metrics_for_all_fields.call_count == 1
  
      updated_dataset = td_extractor.update_dataset(
          dataset, update_records=True
      )
  
      td_extractor._extract_metrics_for_all_fields.call_count == 3
      td_extractor._cast_to_python_types.assert_called_with(
          extracted_metrics
      )
      td_extractor._clean_column_name.assert_called_with(
          "text_n_tokens"
      )
      td_extractor._create_metadata_properties.assert_called_with(
          extracted_metrics
      )
      assert updated_dataset == dataset
      assert isinstance(updated_dataset, FeedbackDataset)
      assert updated_dataset.metadata_properties == [
          IntegerMetadataProperty(
              name="text_n_tokens",
              title="text_n_tokens",
              visible_for_annotators=True,
              type="integer",
              min=None,
              max=None,
          )
      ]
  
imports: from unittest.mock import MagicMock
  import pandas
  import pytest
  from argilla.client.feedback.dataset import FeedbackDataset
  from argilla.client.feedback.integrations.textdescriptives import TextDescriptivesExtractor
  from argilla.client.feedback.schemas.fields import TextField
  from argilla.client.feedback.schemas.metadata import FloatMetadataProperty, IntegerMetadataProperty, TermsMetadataProperty
  from argilla.client.feedback.schemas.questions import TextQuestion
  from argilla.client.feedback.schemas.records import FeedbackRecord
label_desc: Use image node_id 11 for calling a global function with example usage: test_update_feedback_dataset(td_extractor) without return types