コード例 #1
0
ファイル: test_dns.py プロジェクト: svenseeberg/salt
    def test_weight(self):
        recs = [
            [],
            [{"weight": 100, "name": "nescio"}],
            [
                {"weight": 100, "name": "nescio1"},
                {"weight": 100, "name": "nescio2"},
                {"weight": 100, "name": "nescio3"},
                {"weight": 100, "name": "nescio4"},
                {"weight": 100, "name": "nescio5"},
                {"weight": 100, "name": "nescio6"},
                {"weight": 100, "name": "nescio7"},
                {"weight": 100, "name": "nescio8"},
            ],
        ]

        # What are the odds of this tripping over a build
        # 1/(8!^4) builds?
        self.assertNotEqual(
            _weighted_order(list(recs[-1])),
            _weighted_order(list(recs[-1])),
            _weighted_order(list(recs[-1])),
        )

        for recset in recs:
            rs_res = _weighted_order(list(recset))
            self.assertTrue(all(rec["name"] in rs_res for rec in recset))
コード例 #2
0
ファイル: test_dns.py プロジェクト: tschmittni/salt
    def test_weight(self):
        recs = [
            [],
            [{'weight': 100, 'name': 'nescio'}],
            [
                {'weight': 100, 'name': 'nescio1'},
                {'weight': 100, 'name': 'nescio2'},
                {'weight': 100, 'name': 'nescio3'},
                {'weight': 100, 'name': 'nescio4'},
                {'weight': 100, 'name': 'nescio5'},
                {'weight': 100, 'name': 'nescio6'},
                {'weight': 100, 'name': 'nescio7'},
                {'weight': 100, 'name': 'nescio8'}
            ]
        ]

        # What are the odds of this tripping over a build
        self.assertNotEqual(
            _weighted_order(list(recs[-1])),
            _weighted_order(list(recs[-1]))
        )

        for recset in recs:
            rs_res = _weighted_order(list(recset))
            self.assertTrue(all(rec['name'] in rs_res for rec in recset))