code: def test_add_to_collection(self):
      config = de_config_pb2.DynamicEmbeddingConfig(
          embedding_dimension=5
      )
      context.add_to_collection("first", config)
      context.add_to_collection("second", config)
      context.add_to_collection("first", config)  # ok to add twice.
      self.assertLen(context._knowledge_bank_collections, 2)
  
      # Empty name.
      with self.assertRaises(ValueError):
          context.add_to_collection("", config)
      # Wrong config type.
      with self.assertRaises(TypeError):
          context.add_to_collection("first", "config")
      # Checks adding a different config with the same name is not allowed.
      config.embedding_dimension = 10
      with self.assertRaises(ValueError):
          context.add_to_collection("first", config)
  
file_path: neural-structured-learning/research/carls/context_test.py
imports: from research.carls import context
  from research.carls import dynamic_embedding_config_pb2
  import tensorflow
label_desc: Use image node_id 1 for calling the ContextTest obj's underlying member method code with example usage: obj.test_add_to_collection() without return types