def test_j_range(self):
        from dwave.system.composites.virtual_graph import _validate_chain_strength

        Sampler = collections.namedtuple('Sampler', ['properties'])
        sampler = Sampler({'j_range': [-1.0, 1.0]})

        self.assertEqual(_validate_chain_strength(sampler, None), 1.0)
        self.assertEqual(_validate_chain_strength(sampler, .5), .5)

        with self.assertRaises(ValueError):
            _validate_chain_strength(sampler, 1.5)
    def test_no_properties(self):
        from dwave.system.composites.virtual_graph import _validate_chain_strength

        Sampler = collections.namedtuple('Sampler', ['properties'])
        sampler = Sampler({})

        with self.assertRaises(ValueError):
            _validate_chain_strength(sampler, None)

        with self.assertRaises(ValueError):
            _validate_chain_strength(sampler, 1.0)