docstr: This test only works if the samples do not have Classification or
  Detection fields because of the autogenerated ObjectIDs.
docstr_tok: ["This","test","only","works","if","the","samples","do","not","have","Classification","or","Detection","fields","because","of","the","autogenerated","ObjectIDs","."]
code: def test_sample_in_dataset(self):
      """This test only works if the samples do not have Classification or
      Detection fields because of the autogenerated ObjectIDs.
      """
      dataset1 = fo.Dataset()
      dataset2 = fo.Dataset()
  
      sample1 = fo.Sample(
          filepath="~/Desktop/test.png",
          tags=["test"],
          vector=np.arange(5),
          array=np.ones((2, 3)),
          float=5.1,
          bool=True,
          int=51,
      )
  
      sample2 = fo.Sample(
          filepath="~/Desktop/test.png",
          tags=["test"],
          vector=np.arange(5),
          array=np.ones((2, 3)),
          float=5.1,
          bool=True,
          int=51,
      )
  
      self.assertDictEqual(sample1.to_dict(), sample2.to_dict())
  
      dataset1.add_sample(sample1)
      dataset2.add_sample(sample2)
  
      self.assertNotEqual(sample1, sample2)
  
      s1 = fo.Sample.from_dict(sample1.to_dict())
      s2 = fo.Sample.from_dict(sample2.to_dict())
  
      self.assertFalse(s1.in_dataset)
      self.assertNotEqual(s1, sample1)
  
      self.assertDictEqual(s1.to_dict(), s2.to_dict())
  
imports: import time
  import unittest
  from unittest.mock import MagicMock, patch
  import numpy
  import fiftyone
  import fiftyone.constants
  import fiftyone.core.media
  import fiftyone.core.odm
  import fiftyone.core.utils
  from fiftyone.migrations.runner import MigrationRunner
  from decorators import drop_datasets
  from bson import ObjectId
  from fiftyone.core.odm.utils import load_dataset
label_desc: Use image node_id 3 for calling the SerializationTests obj's underlying member method code with example usage: obj.test_sample_in_dataset() without return types