code: def test_modify_video_sample(self):
      dataset = fo.Dataset()
  
      sample = fo.Sample(filepath="video.mp4")
      dataset.add_sample(sample)
  
      # Intentionally out of order to test sorting
      sample.frames[1] = fo.Frame(frame_number=1)
      sample.frames[5] = fo.Frame()
      sample.frames[3] = fo.Frame(hello="world")
  
      self.assertEqual(len(sample.frames), 3)
      self.assertIsNone(sample.frames[1].id)
      self.assertIsNone(sample.frames[3].id)
      self.assertIsNone(sample.frames[5].id)
  
      sample.save()
  
      self.assertEqual(len(sample.frames), 3)
      self.assertIsNotNone(sample.frames[1].id)
      self.assertIsNotNone(sample.frames[3].id)
      self.assertIsNotNone(sample.frames[5].id)
      self.assertTrue(dataset.has_frame_field("hello"))
  
      frame2 = sample.frames[2]
  
      self.assertIsNone(frame2.id)
      self.assertEqual(len(sample.frames), 4)
      self.assertListEqual(list(sample.frames.keys()), [1, 2, 3, 5])
  
      sample.save()
  
      self.assertIsNotNone(frame2.id)
      self.assertEqual(len(sample.frames), 4)
      self.assertListEqual(list(sample.frames.keys()), [1, 2, 3, 5])
  
      del sample.frames[3]
  
      self.assertEqual(len(sample.frames), 3)
      self.assertListEqual(list(sample.frames.keys()), [1, 2, 5])
  
      sample.save()
  
      self.assertEqual(len(sample.frames), 3)
      self.assertListEqual(list(sample.frames.keys()), [1, 2, 5])
  
      sample.frames.clear()
  
      self.assertEqual(len(sample.frames), 0)
      self.assertListEqual(list(sample.frames.keys()), [])
  
      sample.save()
  
      self.assertEqual(len(sample.frames), 0)
      self.assertListEqual(list(sample.frames.keys()), [])
  
      sample.frames[1] = fo.Frame(goodbye="world")
  
      self.assertTrue(dataset.has_frame_field("goodbye"))
  
      with self.assertRaises(ValueError):
          sample.frames.add_frame(
              2, fo.Frame(foo="bar"), expand_schema=False
          )
  
imports: from copy import deepcopy
  from datetime import date, datetime
  from bson import ObjectId
  import numpy
  import unittest
  import fiftyone
  import fiftyone.core.odm
  from fiftyone import ViewField
  from decorators import drop_datasets
label_desc: Use image node_id 9 for calling the VideoTests obj's underlying member method code with example usage: obj.test_modify_video_sample() without return types