def test_TRZyamlIO(self): geom = SystemLayoutInput() geom.readGeomFromFile(os.path.join(TEST_ROOT, "trz_geom.xml")) fName = "testTRZYamlIO.yaml" with open(fName, "w") as f: geom._writeYaml(f) # pylint: disable=protected-access with open(fName) as f: geom2 = SystemLayoutInput() geom2._readYaml(f) # pylint: disable=protected-access self.assertEqual(geom2.assemTypeByIndices[2.0, 3.0, 0.0, 180.0, 1, 1], "MC") os.remove(fName)
def test_yamlIO(self): """Ensure we can read and write to YAML formatted streams.""" geom = SystemLayoutInput() geom.readGeomFromStream(io.StringIO(GEOM_INPUT)) fName = "testYamlIO.yaml" with open(fName, "w") as f: geom._writeYaml(f) # pylint: disable=protected-access with open(fName) as f: geom2 = SystemLayoutInput() geom2._readYaml(f) # pylint: disable=protected-access self.assertEqual(geom2.assemTypeByIndices[2, 2], "A2") os.remove(fName)