def test_zoneSummary(self): o, r = test_reactors.loadTestReactor() r.core.buildZones(o.cs) daZones = r.core.zones # make sure we have a couple of zones to test on for name0 in ["ring-1-radial-shield-5", "ring-1-feed-fuel-5"]: self.assertIn(name0, daZones.names) with mockRunLogs.BufferLog() as mock: runLog.LOG.startLog("test_zoneSummary") runLog.LOG.setVerbosity(logging.INFO) self.assertEqual("", mock._outputStream) daZones.summary() self.assertIn("Zone Summary", mock._outputStream) self.assertIn("Zone Power", mock._outputStream) self.assertIn("Zone Average Flow", mock._outputStream)
def test_checkForDuplicateObjectsOnArmiModel(self): with mockRunLogs.BufferLog() as mock: # we should start with a clean slate self.assertEqual("", mock._outputStream) testName = "test_checkForDuplicateObjectsOnArmiModel" runLog.LOG.startLog(testName) runLog.LOG.setVerbosity(logging.IMPORTANT) # check for duplicates with self.assertRaises(RuntimeError): self.memPro.checkForDuplicateObjectsOnArmiModel( "cs", self.r.core) # validate the outputs are as we expect self.assertIn("There are 2 unique objects stored as `.cs`", mock._outputStream) self.assertIn("Expected id", mock._outputStream) self.assertIn("Expected object", mock._outputStream) self.assertIn("These types of objects", mock._outputStream) self.assertIn("MemoryProfiler", mock._outputStream) self.assertIn("MainInterface", mock._outputStream)
def test_warn_once_decorator(self): with mockRunLogs.BufferLog() as mock: for ii in range(1, 4): self.exampleWarnOnceMessage() self.assertEqual("[warn] single warning\n", mock._outputStream.getvalue())
def test_nucBases_factoryIsFast(self): with mockRunLogs.BufferLog(): nuclideBases.factory(True) # If we don't re-apply the default burn chain, subsequent tests will fail isotopicDepletion.applyDefaultBurnChain()
def setUp(self): with mockRunLogs.BufferLog(): elements.factory() nuclideBases.factory()
def test_factory(self): with mockRunLogs.BufferLog(): elements.factory()
def test_compare(self): with mockRunLogs.BufferLog() as _log: self.assertTrue(dlayxs.compare(self.dlayxs3, copy.deepcopy(self.dlayxs3)))
def test_reactorSpecificReporting(self): """Test a number of reporting utils that require reactor/core information""" o, r = loadTestReactor() with mockRunLogs.BufferLog() as mock: # we should start with a clean slate self.assertEqual("", mock._outputStream) runLog.LOG.startLog("test_reactorSpecificReporting") runLog.LOG.setVerbosity(logging.INFO) writeAssemblyMassSummary(r) self.assertIn("BOL Assembly Mass Summary", mock._outputStream) self.assertIn("igniter fuel", mock._outputStream) self.assertIn("primary control", mock._outputStream) self.assertIn("plenum", mock._outputStream) mock._outputStream = "" setNeutronBalancesReport(r.core) self.assertIn("No rate information", mock._outputStream) mock._outputStream = "" r.core.getFirstBlock().p.rateCap = 1.0 r.core.getFirstBlock().p.rateProdFis = 1.02 r.core.getFirstBlock().p.rateFis = 1.01 r.core.getFirstBlock().p.rateAbs = 1.0 setNeutronBalancesReport(r.core) self.assertIn("Fission", mock._outputStream) self.assertIn("Capture", mock._outputStream) self.assertIn("Absorption", mock._outputStream) self.assertIn("Leakage", mock._outputStream) mock._outputStream = "" summarizePinDesign(r.core) self.assertIn("Assembly Design Summary", mock._outputStream) self.assertIn("Design & component information", mock._outputStream) self.assertIn("Multiplicity", mock._outputStream) mock._outputStream = "" summarizePower(r.core) self.assertIn("Power in radial shield", mock._outputStream) self.assertIn("Power in primary control", mock._outputStream) self.assertIn("Power in feed fuel", mock._outputStream) mock._outputStream = "" writeCycleSummary(r.core) self.assertIn("Core Average", mock._outputStream) self.assertIn("Outlet Temp", mock._outputStream) self.assertIn("End of Cycle", mock._outputStream) mock._outputStream = "" # this report won't do much for the test reactor - improve test reactor summarizeZones(r.core, o.cs) self.assertEqual(len(mock._outputStream), 0) mock._outputStream = "" # this report won't do much for the test reactor - improve test reactor makeBlockDesignReport(r) self.assertEqual(len(mock._outputStream), 0) mock._outputStream = "" # this report won't do much for the test reactor - improve test reactor summarizePowerPeaking(r.core) self.assertEqual(len(mock._outputStream), 0)