コード例 #1
0
    def test_correct_spokes_ordering(self):
        # create fake spokes with the same priority
        hub = create_autospec(Hub)

        class SpokeA(StandaloneSpoke):  # pylint: disable=abstract-method
            preForHub = hub

        class SpokeB(StandaloneSpoke):  # pylint: disable=abstract-method
            preForHub = hub

        class SpokeC(StandaloneSpoke):  # pylint: disable=abstract-method
            preForHub = hub

        class SpokeD(StandaloneSpoke):  # pylint: disable=abstract-method
            postForHub = hub

        class SpokeE(StandaloneSpoke):  # pylint: disable=abstract-method
            postForHub = hub

        list1 = [SpokeC, SpokeB, SpokeE, SpokeD, SpokeA]

        # the input list ordering shouldn't matter sorting should be based on class names
        assert [SpokeA, SpokeB, SpokeC, hub, SpokeD, SpokeE] == \
            UserInterface._orderActionClasses(list1, [hub])