def test_instantiation_from_config(self, config: Dict[str, Any]): """ GIVEN a valid config for a BinnedUniformSampler WHEN the classmethod `from_config` is called with this config THEN a BinnedUniformSampler is instantiated. """ BinnedUniformSampler.from_config(config)
def sampler(self, config: Dict[str, Any]) -> BinnedUniformSampler: """Fixture that provides an instantiated sampler. :param config: The config-fixture for the sampler. :type config: Dict[str,Any] :return: The instantiated sampler :rtype: BinnedUniformSampler """ return BinnedUniformSampler.from_config(config)
def test_instantiation_from_to_dict_output(self, sampler: BinnedUniformSampler): """ GIVEN the output from a samplers `to_dict` method WHEN a new sampler is instantiated from this output via the `from_config` classmethod THEN the two resulting samplers are equal. """ representation = sampler.to_dict() clone = BinnedUniformSampler.from_config(representation) assert clone == sampler