'Test aggregation of aggregates'

def testAggregate(self):

    assertTrue = self.assertTrue
    assertEqual = self.assertEqual
    assertRaises = self.assertRaises
    values1 = [2, 4, 6, 12]
    ga1 = S3GroupAggregate('avg', 'Example', values1)
    assertEqual(ga1.result, 6.0)
    values2 = [5, 3, 9, 8]
    ga2 = S3GroupAggregate('avg', 'Example', values2)
    assertEqual(ga2.result, 6.25)
    ga = S3GroupAggregate.aggregate((ga1, ga2))
    assertEqual(ga.result, 6.125)
    for value in (values1 + values2):
        assertTrue((value in ga.values))
    ga = S3GroupAggregate('min', 'Example', values1)
    with assertRaises(TypeError):
        S3GroupAggregate((ga1, ga2, ga))
    ga = S3GroupAggregate('avg', 'Other', values1)
    with assertRaises(TypeError):
        S3GroupAggregate((ga1, ga2, ga))
