def test_priorities(self):
        """Hooks should sort by priority order."""
        Hook = cherrypy._cprequest.Hook
        hooks = [
            Hook(None, priority=48),
            Hook(None),
            Hook(None, priority=49),
        ]
        hooks.sort()
        by_priority = operator.attrgetter('priority')
        priorities = list(map(by_priority, hooks))
        assert priorities == [48, 49, 50]
Hooks should sort by priority order.
cherrypy/test/test_tools.py