code: def test_write_to_datastore(self):
      # add 2 batches and 3 images, write everything to datastore
      self.image_batches.add_batch(
          "batch1", batch_properties={"k1": "v1", "k2": "v2"}
      )
      self.image_batches.add_batch(
          "batch2", batch_properties={"k3": "v3"}
      )
      self.image_batches.add_image(
          "batch1", "img1", image_properties={"k4": "v4"}
      )
      self.image_batches.add_image(
          "batch1", "img2", image_properties={"k5": "v5"}
      )
      self.image_batches.add_image(
          "batch2", "img3", image_properties={"k6": "v6"}
      )
      self.image_batches.write_to_datastore()
      # verify batches
      batch_entity1 = self.datastore_client.entity(
          fake_cloud_client.FakeDatastoreKey("Batch", "batch1")
      )
      batch_entity1.update({"k1": "v1", "k2": "v2"})
      batch_entity2 = self.datastore_client.entity(
          fake_cloud_client.FakeDatastoreKey("Batch", "batch2")
      )
      batch_entity2.update({"k3": "v3"})
      assertCountEqual(
          self,
          [batch_entity1, batch_entity2],
          self.datastore_client.query_fetch(kind="Batch"),
      )
      # verify images
      img_entity1 = self.datastore_client.entity(
          fake_cloud_client.FakeDatastoreKey(
              "Batch", "batch2", "Image", "img1"
          )
      )
      img_entity1.update({"k4": "v4"})
      img_entity2 = self.datastore_client.entity(
          fake_cloud_client.FakeDatastoreKey(
              "Batch", "batch2", "Image", "img2"
          )
      )
      img_entity2.update({"k5": "v5"})
      img_entity3 = self.datastore_client.entity(
          fake_cloud_client.FakeDatastoreKey(
              "Batch", "batch2", "Image", "img3"
          )
      )
      img_entity3.update({"k6": "v6"})
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import itertools
  import unittest
  from six import assertCountEqual
  from eval_lib import image_batches
  from eval_lib import submissions
  from eval_lib.tests import fake_cloud_client
label_desc: Use image node_id 4 for calling the ImageBatchesBaseTest obj's underlying member method code with example usage: obj.test_write_to_datastore() without return types