class_docstr: Tests ensuring that when a dataset or samples in a dataset are modified,
  those changes are passed on the the database and can be seen in different
  scopes (or processes!).
class_docstr_tok: ["Tests","ensuring","that","when","a","dataset","or","samples","in","a","dataset","are","modified",",","those","changes","are","passed","on","the","the","database","and","can","be","seen","in","different","scopes","(","or","processes","!",")","."]
code: def test_set_field_create(self):
      dataset_name = self.test_set_field_create.__name__
  
      def create_dataset():
          dataset = fo.Dataset(dataset_name)
          sample = fo.Sample(filepath="/path/to/image.jpg")
          return dataset.add_sample(sample)
  
      sample_id = create_dataset()
  
      field_name = "field2"
      value = 51
  
      def set_field_create(sample_id):
          dataset = fo.load_dataset(dataset_name)
          sample = dataset[sample_id]
          sample[field_name] = value
          sample.save()
  
      def check_set_field_create(sample_id):
          dataset = fo.load_dataset(dataset_name)
          fields = dataset.get_field_schema()
          self.assertIn(field_name, fields)
  
          sample = dataset[sample_id]
          self.assertEqual(sample[field_name], value)
  
      set_field_create(sample_id)
      check_set_field_create(sample_id)
  
file_path: fiftyone/tests/unittests/synchronization_tests.py
imports: import os
  import unittest
  import fiftyone
  from decorators import drop_datasets
label_desc: Use image node_id 4 for calling the ScopedObjectsSynchronizationTests obj's underlying member method code with example usage: obj.test_set_field_create() and returns: dataset