'Verify that S3GroupedItems accepts single axis-parameter,
and retains the original order of groups'

def testSingleAxisGrouping(self):

    assertEqual = self.assertEqual
    assertTrue = self.assertTrue
    assertIn = self.assertIn
    items = [{'name': 'Item1', 'type': 'A'}, {'name': 'Item2', 'type': ['C', 'D']}, {'name': 'Item3', 'type': 'D'}, {'name': 'Item4', 'type': 'B'}, {'name': 'Item5', 'type': 'A'}, {'name': 'Item6', 'type': 'D'}, {'name': 'Item7', 'type': 'E'}]
    types = ['A', 'C', 'D', 'B', 'E']
    gi = S3GroupedItems(items, groupby='type')
    for (g, group) in enumerate(gi.groups):
        assertEqual(group['type'], types[g])
        group_items = group.items
        if (not group_items):
            continue
        last = (len(group_items) - 1)
        for (i, item) in enumerate(group_items):
            value = item['type']
            if (type(value) is list):
                assertIn(group['type'], value)
            else:
                assertEqual(group['type'], value)
            if (i < last):
                assertTrue((item['name'] < group_items[(i + 1)]['name']))
