Ejemplo n.º 1
0
 def test_to_dict_is_yaml_serializable(self, sampler: BinnedUniformSampler):
     """
     GIVEN an instantiated BinnedUniformSampler
     WHEN the instance's `to_dict` method is called and the output is dumped to YAML
     THEN no exception is raised.
     """
     yaml.dump(sampler.to_dict())
Ejemplo n.º 2
0
 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