def test_aggregate_results(self):
        self.maxDiff = None
        self.assertEqual(BenchmarkResults._aggregate_results(
            {'SomeTest': {'metrics': {'Time': {'current': [1, 2, 3]}}}}),
            {'SomeTest': {'metrics': {'Time': {None: {'current': [1, 2, 3]}}}, 'tests': {}}})

        self.assertEqual(BenchmarkResults._aggregate_results(
            {'SomeTest': {
                'metrics': {'Time': ['Total']},
                'tests': {
                    'SubTest1': {'metrics': {'Time': {'current': [1, 2, 3]}}},
                    'SubTest2': {'metrics': {'Time': {'current': [4, 5, 6]}}}}}}),
            {'SomeTest': {
                'metrics': {'Time': {'Total': {'current': [5, 7, 9]}}},
                'tests': {
                    'SubTest1': {'metrics': {'Time': {None: {'current': [1, 2, 3]}}}, 'tests': {}},
                    'SubTest2': {'metrics': {'Time': {None: {'current': [4, 5, 6]}}}, 'tests': {}}}}})

        self.assertEqual(BenchmarkResults._aggregate_results(
            {'SomeTest': {
                'metrics': {'Time': ['Total'], 'Runs': ['Total']},
                'tests': {
                    'SubTest1': {'metrics': {'Time': {'current': [1, 2, 3]}}},
                    'SubTest2': {'metrics': {'Time': {'current': [4, 5, 6]}}},
                    'SubTest3': {'metrics': {'Runs': {'current': [7, 8, 9]}}}}}}),
            {'SomeTest': {
                'metrics': {
                    'Time': {'Total': {'current': [5, 7, 9]}},
                    'Runs': {'Total': {'current': [7, 8, 9]}}},
                'tests': {
                    'SubTest1': {'metrics': {'Time': {None: {'current': [1, 2, 3]}}}, 'tests': {}},
                    'SubTest2': {'metrics': {'Time': {None: {'current': [4, 5, 6]}}}, 'tests': {}},
                    'SubTest3': {'metrics': {'Runs': {None: {'current': [7, 8, 9]}}}, 'tests': {}}}}})
    def test_aggregate_nested_results(self):
        self.maxDiff = None
        self.assertEqual(BenchmarkResults._aggregate_results(
            {'SomeTest': {
                'metrics': {'Time': ['Total']},
                'tests': {
                    'SubTest1': {
                        'metrics': {'Time': ['Total']},
                        'tests': {
                            'GrandChild1': {'metrics': {'Time': {'current': [1, 2]}}},
                            'GrandChild2': {'metrics': {'Time': {'current': [3, 4]}}}}},
                    'SubTest2': {'metrics': {'Time': {'current': [5, 6]}}}}}}),
            {'SomeTest': {
                'metrics': {'Time': {'Total': {'current': [9, 12]}}},
                'tests': {
                    'SubTest1': {
                        'metrics': {'Time': {'Total': {'current': [4, 6]}}},
                        'tests': {
                            'GrandChild1': {'metrics': {'Time': {None: {'current': [1, 2]}}}, 'tests': {}},
                            'GrandChild2': {'metrics': {'Time': {None: {'current': [3, 4]}}}, 'tests': {}}}},
                    'SubTest2': {'metrics': {'Time': {None: {'current': [5, 6]}}}, 'tests': {}}}}})

        self.assertEqual(BenchmarkResults._aggregate_results(
            {'SomeTest': {
                'metrics': {'Time': ['Total']},
                'tests': {
                    'SubTest1': {
                        'metrics': {'Time': ['Total', 'Arithmetic']},
                        'tests': {
                            'GrandChild1': {'metrics': {'Time': {'current': [1, 2]}}},
                            'GrandChild2': {'metrics': {'Time': {'current': [3, 4]}}}}},
                    'SubTest2': {'metrics': {'Time': {'current': [5, 6]}}}}}}),
            {'SomeTest': {
                'metrics': {'Time': {'Total': {'current': [9, 12]}}},
                'tests': {
                    'SubTest1': {
                        'metrics': {'Time': {'Total': {'current': [4, 6]}, 'Arithmetic': {'current': [2, 3]}}},
                        'tests': {
                            'GrandChild1': {'metrics': {'Time': {None: {'current': [1, 2]}}}, 'tests': {}},
                            'GrandChild2': {'metrics': {'Time': {None: {'current': [3, 4]}}}, 'tests': {}}}},
                    'SubTest2': {'metrics': {'Time': {None: {'current': [5, 6]}}}, 'tests': {}}}}})
 def test_aggregate_results_with_gropus(self):
     self.maxDiff = None
     self.assertEqual(BenchmarkResults._aggregate_results(
         {'SomeTest': {
             'metrics': {'Time': ['Total']},
             'tests': {
                 'SubTest1': {'metrics': {'Time': {'current': [[1, 2], [3, 4]]}}},
                 'SubTest2': {'metrics': {'Time': {'current': [[5, 6], [7, 8]]}}}}}}),
         {'SomeTest': {
             'metrics': {'Time': {'Total': {'current': [6, 8, 10, 12]}}},
             'tests': {
                 'SubTest1': {'metrics': {'Time': {None: {'current': [1, 2, 3, 4]}}}, 'tests': {}},
                 'SubTest2': {'metrics': {'Time': {None: {'current': [5, 6, 7, 8]}}}, 'tests': {}}}}})
 def test_aggregate_results_from_another_aggregator(self):
     self.maxDiff = None
     self.assertEqual(BenchmarkResults._aggregate_results(
         {'SomeTest': {
             'metrics': {'Time': ['Arithmetic', 'Geometric']},
             'tests': {
                 'SubTest1': {
                     'metrics': {'Time': ['Total']},
                     'tests': {
                         'GrandChild1': {'metrics': {'Time': {'current': [1, 2]}}},
                         'GrandChild2': {'metrics': {'Time': {'current': [3, 4]}}}}},
                 'SubTest2': {'metrics': {'Time': {'current': [9, 24]}}}}}}),
         {'SomeTest': {
             'metrics': {'Time': {'Geometric': {'current': [6.0, 12.0]}, 'Arithmetic': {'current': [6, 15]}}},
             'tests': {
                 'SubTest1': {
                     'metrics': {'Time': {'Total': {'current': [4, 6]}}},
                     'tests': {
                         'GrandChild1': {'metrics': {'Time': {None: {'current': [1, 2]}}}, 'tests': {}},
                         'GrandChild2': {'metrics': {'Time': {None: {'current': [3, 4]}}}, 'tests': {}}}},
                 'SubTest2': {'metrics': {'Time': {None: {'current': [9, 24]}}}, 'tests': {}}}}})