Exemple #1
0
 def test_readAsciimap(self):
     geom = SystemLayoutInput()
     geom._readYaml(io.StringIO(GEOM_INPUT_YAML))
     self.assertEqual(geom.assemTypeByIndices[(1, 1)], "IC")
     self.assertEqual(geom.assemTypeByIndices[(4, 1)], "US")
     # check top edge since it's complicated.
     self.assertEqual(geom.assemTypeByIndices[(10, 10)], "SH")
     self.assertEqual(geom.assemTypeByIndices[(11, 13)], "SH")
Exemple #2
0
 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)
Exemple #3
0
 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)