code: def test_sum_scalar_tree_aggregation_reset(
      self, scalar_value, tree_node_value, period
  ):
      total_steps = 20
      indicator = restart_query.PeriodicRoundRestartIndicator(period)
      query = tree_aggregation_query.TreeCumulativeSumQuery(
          clip_fn=_get_l2_clip_fn(),
          clip_value=scalar_value + 1.0,  # no clip
          noise_generator=lambda: tree_node_value,
          record_specs=tf.TensorSpec([]),
          use_efficient=False,
      )
      query = restart_query.RestartQuery(query, indicator)
      global_state = query.initial_global_state()
      params = query.derive_sample_params(global_state)
      for i in range(total_steps):
          sample_state = query.initial_sample_state(scalar_value)
          sample_state = query.accumulate_record(
              params, sample_state, scalar_value
          )
          query_result, global_state, _ = query.get_noised_result(
              sample_state, global_state
          )
          # Expected value is the combination of cumsum of signal; sum of trees
          # that have been reset; current tree sum. The tree aggregation value can
          # be inferred from the binary representation of the current step.
          expected = (
              scalar_value * (i + 1)
              + i
              // period
              * tree_node_value
              * bin(period)[2:].count("1")
              + tree_node_value * bin(i % period + 1)[2:].count("1")
          )
          self.assertEqual(query_result, expected)
  
imports: import unittest
  from absl.testing import parameterized
  import tensorflow
  from tensorflow_privacy.privacy.dp_query import restart_query
  from tensorflow_privacy.privacy.dp_query import tree_aggregation_query
label_desc: Use image node_id 1 for calling the RestartQueryTest obj's underlying member method code with example usage: obj.test_sum_scalar_tree_aggregation_reset(scalar_value, tree_node_value, period) without return types