def testRawValuePrecedence(self):

        assertEqual = self.assertEqual

        items = [
            {"name": "Item1", "type": "A", "_row": {"name": "Item1", "type": "X"}},
            {"name": "Item2", "type": "C", "_row": {"name": "Item2", "type": "Y"}},
            {"name": "Item3", "type": "D", "_row": {"name": "Item3", "type": "Z"}},
            {"name": "Item4", "type": "B", "_row": "test"},
            {"name": "Item5", "type": "A", "_row": {"name": "Item5", "type": "X"}},
            {"name": "Item6", "type": "D", "_row": {"name": "Item6", "type": "Z"}},
            {"name": "Item7", "type": "E"},
        ]

        # The original order of types in the items (=order of first appearance)
        types = ["X", "Y", "Z", "B", "E"]

        gi = S3GroupedItems(items, groupby=["type"])

        # Order of groups should match the original order
        for index, group in enumerate(gi.groups):
            assertEqual(group["type"], types[index])

    # -------------------------------------------------------------------------
Verify that raw values are preferred for grouping,
dataset/ETHPy150Open sahana/eden/modules/unit_tests/s3/s3grouped.py/S3GroupedItemsTests.testRawValuePrecedence