def test_bad_add(self):
        base = {
            'replicas': 3, 'part_power': 8, 'random_seed': 123, 'overload': 0}

        # no dev
        busted = dict(base, rounds=[[['add']]])
        self.assertRaises(ValueError, parse_scenario, json.dumps(busted))

        # no weight
        busted = dict(base, rounds=[[['add', 'r1z2-1.2.3.4:6200/d7']]])
        self.assertRaises(ValueError, parse_scenario, json.dumps(busted))

        # too many fields
        busted = dict(base, rounds=[[['add', 'r1z2-1.2.3.4:6200/d7', 1, 2]]])
        self.assertRaises(ValueError, parse_scenario, json.dumps(busted))

        # can't parse
        busted = dict(base, rounds=[[['add', 'not a good value', 100]]])
        # N.B. the ValueError's coming out of ring.utils.parse_add_value
        # are already pretty good
        expected = "Invalid device specifier (round 0, command 0): " \
            "Invalid add value: not a good value"
        try:
            parse_scenario(json.dumps(busted))
        except __HOLE__ as err:
            self.assertEqual(str(err), expected)

        # negative weight
        busted = dict(base, rounds=[[['add', 'r1z2-1.2.3.4:6200/d7', -1]]])
        self.assertRaises(ValueError, parse_scenario, json.dumps(busted))
dataset/ETHPy150Open openstack/swift/test/unit/cli/test_ring_builder_analyzer.py/TestParseScenario.test_bad_add