def test_environment(self): # Basic environment should be the same as tskit. d_tszip = provenance.get_provenance_dict({}) d_tskit = tskit.provenance.get_provenance_dict() self.assertEqual(d_tszip["environment"]["os"], d_tskit["environment"]["os"]) self.assertEqual(d_tszip["environment"]["python"], d_tskit["environment"]["python"])
def test_provenance(self): ts = msprime.simulate(10, random_seed=1) for variants_only in [True, False]: tszip.compress(ts, self.path, variants_only=variants_only) with zarr.ZipStore(str(self.path), mode='r') as store: root = zarr.group(store=store) self.assertEqual( root.attrs["provenance"], provenance.get_provenance_dict( {"variants_only": variants_only}))
def test_parameters(self): for params in [{}, {"a": "a"}, {"a": {"a": 1}}]: d = provenance.get_provenance_dict(params)["parameters"] self.assertEqual(d, params)
def test_sofware(self): software = provenance.get_provenance_dict({})["software"] self.assertEqual(software, { "name": "tszip", "version": tszip.__version__ })
def test_libraries(self): libs = provenance.get_provenance_dict({})["environment"]["libraries"] self.assertEqual(libs["tskit"]["version"], tskit.__version__) self.assertEqual(libs["zarr"]["version"], zarr.__version__) self.assertEqual(libs["numcodecs"]["version"], numcodecs.__version__)
def test_schema_validates(self): for params in [{}, {"a": "a"}, {"a": {"a": 1}}]: d = provenance.get_provenance_dict(params) tskit.validate_provenance(d)