code: def test_by_val_capture_tuples(self):
      fn_captures = capture_container.FunctionCaptures()
  
      with self.subTest("initial_state"):
          self.assertEmpty(fn_captures.by_val_capture_tuples)
  
      with self.subTest("add"):
          fn_captures.add_or_replace("a", 1, -1, is_by_ref=False)
          self.assertLen(fn_captures.by_val_capture_tuples, 1)
          self.assertSequenceEqual(
              fn_captures.by_val_capture_tuples, ((1, -1),)
          )
  
          fn_captures.add_or_replace("b", 2, -2, is_by_ref=False)
          self.assertLen(fn_captures.by_val_capture_tuples, 2)
          self.assertSequenceEqual(
              fn_captures.by_val_capture_tuples, ((1, -1), (2, -2))
          )
  
      with self.subTest("replace"):
          fn_captures.add_or_replace("a", 1, -3, is_by_ref=False)
          self.assertLen(fn_captures.by_val_capture_tuples, 2)
          self.assertSequenceEqual(
              fn_captures.by_val_capture_tuples, ((1, -3), (2, -2))
          )
  
      with self.subTest("pop"):
          fn_captures.pop("b", is_by_ref=False)
          self.assertSequenceEqual(
              fn_captures.by_val_capture_tuples, ((1, -3),)
          )
  
      with self.subTest("reset"):
          fn_captures.reset_captures([10, 20], [-10, -20])
          self.assertSequenceEqual(
              fn_captures.by_val_capture_tuples, ((10, -10), (20, -20))
          )
  
      with self.subTest("clear"):
          fn_captures.clear()
          self.assertEmpty(fn_captures.by_val_capture_tuples)
  
file_path: tensorflow-upstream/tensorflow/core/function/capture/capture_container_test.py
imports: import copy
  from absl.testing import parameterized
  from tensorflow.core.function import trace_type
  from tensorflow.core.function.capture import capture_container
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the FunctionCapturesTest obj's underlying member method code with example usage: obj.test_by_val_capture_tuples() without return types