class_docstr: Tests ensuring that when a dataset or samples in a dataset are modified
  all relevant objects are instantly in sync within the same process.
class_docstr_tok: ["Tests","ensuring","that","when","a","dataset","or","samples","in","a","dataset","are","modified","all","relevant","objects","are","instantly","in","sync","within","the","same","process","."]
docstr: Tests that when a sample is deleted from a dataset, the sample is
  disconnected from the dataset.
docstr_tok: ["Tests","that","when","a","sample","is","deleted","from","a","dataset",",","the","sample","is","disconnected","from","the","dataset","."]
code: def test_dataset_delete_samples(self):
      """Tests that when a sample is deleted from a dataset, the sample is
      disconnected from the dataset.
      """
      dataset = fo.Dataset()
  
      # add 1 sample
      sample = fo.Sample(filepath="test1.png")
      dataset.add_sample(sample)
      self.assertTrue(sample.in_dataset)
      self.assertIsNotNone(sample.id)
      self.assertIs(sample.dataset, dataset)
  
      # delete 1 sample
      dataset.delete_samples(sample)
      self.assertFalse(sample.in_dataset)
      self.assertIsNone(sample.id)
      self.assertIsNone(sample.dataset)
  
      # add multiple samples
      filepath_template = "test%d.png"
      num_samples = 10
      samples = [
          fo.Sample(filepath=filepath_template % i)
          for i in range(num_samples)
      ]
      dataset.add_samples(samples)
      for sample in samples:
          self.assertTrue(sample.in_dataset)
          self.assertIsNotNone(sample.id)
          self.assertIs(sample.dataset, dataset)
  
      # delete some
      num_delete = 7
      dataset.delete_samples(
          [sample.id for sample in samples[:num_delete]]
      )
      for i, sample in enumerate(samples):
          if i < num_delete:
              self.assertFalse(sample.in_dataset)
              self.assertIsNone(sample.id)
              self.assertIsNone(sample.dataset)
          else:
              self.assertTrue(sample.in_dataset)
              self.assertIsNotNone(sample.id)
              self.assertIs(sample.dataset, dataset)
  
      # clear dataset
      dataset.clear()
      for sample in samples:
          self.assertFalse(sample.in_dataset)
          self.assertIsNone(sample.id)
          self.assertIsNone(sample.dataset)
  
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 SingleProcessSynchronizationTests obj's underlying member method code with example usage: obj.test_dataset_delete_samples() without return types