def testconvert6(self): NEW_MODEL_TYPE = ModelType('new') NEW_MODEL_TYPE.test = ('test',) # Base options ops = Options(name="Test") ops.beam.energy_eV = 100e3 ops.detectors['xray'] = PhotonIntensityDetector((0, 1), (2, 3)) ops.models.add(NEW_MODEL_TYPE.test) ops.limits.add(ShowersLimit(5678)) # Convert opss = self.converter.convert(ops) self.assertEqual(1, len(opss))
def testconvert6(self): NEW_MODEL_TYPE = ModelType('new') NEW_MODEL_TYPE.test = ('test', ) # Base options ops = Options(name="Test") ops.beam.energy_eV = 100e3 ops.detectors['prz'] = PhiZDetector((0, 1), (2, 3), 1000) ops.models.add(NEW_MODEL_TYPE.test) ops.limits.add(ShowersLimit(5678)) # Convert opss = self.converter.convert(ops) # Test self.assertEqual(1, len(opss))
# Third party modules. from pyxray.transition import Transition # Local modules. from pymontecarlo.fileformat.options.model import \ (_ModelXMLHandler, RegisteredModelXMLHandler, UserDefinedMassAbsorptionCoefficientModelXMLHandler) from pymontecarlo.options.model import \ (ModelType, _Model, UserDefinedMassAbsorptionCoefficientModel, MASS_ABSORPTION_COEFFICIENT) # Globals and constants variables. MTYPE = ModelType('type1') try: MTYPE.m1 = ('name1', 'ref1') MTYPE.m2 = ('name2',) except ValueError: pass # Already imported class TestModelXMLHandler(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.h = _ModelXMLHandler() self.obj1 = _Model(MTYPE, 'name1', 'ref1') self.obj2 = _Model(MTYPE, 'name2')