def test_sort_multiple(self):
        count = 60
        base = date_utils.add_utc_tz(datetime.datetime(2014, 12, 25, 0, 0, 0))
        for i in range(count):
            category = 'type1' if i % 2 else 'type2'
            timestamp = base + datetime.timedelta(seconds=i)
            obj = FakeModelDB(name=uuid.uuid4().hex, timestamp=timestamp, category=category)
            self.access.add_or_update(obj)

        objs = self.access.query(order_by=['category', 'timestamp'])
        self.assertEqual(len(objs), count)
        for i in range(count):
            category = 'type1' if i < count / 2 else 'type2'
            self.assertEqual(objs[i].category, category)
        self.assertLess(objs[0].timestamp, objs[(count / 2) - 1].timestamp)
        self.assertLess(objs[count / 2].timestamp, objs[(count / 2) - 1].timestamp)
        self.assertLess(objs[count / 2].timestamp, objs[count - 1].timestamp)
dataset/ETHPy150Open StackStorm/st2/st2common/tests/unit/test_persistence.py/TestPersistence.test_sort_multiple/original