code: def test_grouping():
      """test the aggregation of individual event attributes"""
  
      class _EventInterface(ABC):
          @define_stats_grouping("group")
          @define_step_stats(sum)
          def event1(self, group, attr1):
              pass
  
      agg = LogStatsAggregator(LogStatsLevel.STEP)
      for v in [1, 3]:
          agg.add_event(
              EventRecord(
                  _EventInterface,
                  _EventInterface.event1,
                  dict(group=0, attr1=v),
              )
          )
          agg.add_event(
              EventRecord(
                  _EventInterface,
                  _EventInterface.event1,
                  dict(group=1, attr1=v * 2),
              )
          )
  
      stats = agg.reduce()
      assert len(stats) == 2
  
      value1 = stats[(_EventInterface.event1, None, (0,))]
      value2 = stats[(_EventInterface.event1, None, (1,))]
  
      assert value1 == 4
      assert value2 == 8
  
file_path: maze/maze/test/core/test_log_stats.py
imports: from abc import ABC
  import numpy
  import pytest
  from maze.core.events.event_record import EventRecord
  from maze.core.log_stats.event_decorators import define_step_stats, define_episode_stats, define_epoch_stats, define_stats_grouping
  from maze.core.log_stats.log_stats import LogStatsAggregator, LogStatsLevel
  from maze.core.log_stats.reducer_functions import histogram
label_desc: Use image node_id 8 for calling a global function with example usage: test_grouping() without return types