Fix Tests for new Decay on Absorb behavior#2
Conversation
|
@gonuke Doesn't look like I have permission to add you as a reviewer, so pinging you like this so it (hopefully) shows up in your inbox |
|
Thanks for the fixes here @dean-krueger All the other decay tests work without a context. I think we may want to have some tests that just decay these different materials directly (ie. without a context) and then some that rely on the context. |
|
I'm not totally clear on what you mean by your comment, but I'll do my best to respond to what I think you mean? The context is important for this specific test where it may not be for others because the new decay on absorb functionality is fundamentally linked to the time at which the materials are said to have been decayed. Since time lives in the context, we need to have it for this particular test. Since this test is specific to the behavior of materials decay when they are combined with the |
|
A couple of related things:
|
A few questions about this:
Is it possible (or more importantly "indented under normal operation") for Cyclus' context to go backwards in time? I didn't think it was, in which case I agree that this would be a bug, and would then argue that a material absorb test is probably not the place to make sure this isn't happening. As always happy to do whatever, just wanted to make sure we were on the same page! |
|
Regarding the context:
|
|
Regarding backward decay:
|
|
Gotcha. I'm going to advocate for moving this conversation/issue to the main PR and separating it from this PR, which simply aims to fix those two failing tests. I will make a comment in the main PR about adding additional tests and reference your explanations. |
|
Refactor these such that we use the REAL context (not the fake context). @gonuke and I talked about one or two other things maybe but I forget what they were. Perhaps I will remember while I'm fixing the first thing, or maybe he'll leave a comment if he remembers. |
|
@gonuke I added the stuff we were talking about (a check to make sure that both materials have a context if we're going to be setting their common decay time to the context time, and a block on backwards decay). This should be ready for another look, and then hopefully we can get this merged so that the other PR (cyclus#1918) can go forward. |
|
I think we need to figure out some rebasing of something somewhere. It's likely that my original PR is now way behind the main branch because this PR into my PR seems to bring a lot of unrelated updates. |
|
oh, yeah. It seems so. Does it work if you just sync your branch with main through GitHub? If not I can go through and try to figure out which commits are extra and pull those out. |
|
This may need a rebase against my rebased branch to isolate the differences for the PR |
…ntext before setting common_decay_time to the context time
9d75ffb to
fd6c654
Compare
|
Rebased and ready for review (I quickly checked that it only has stuff I changed in it now, and I'm PRETTY sure it worked)! @gonuke |
Downstream Build Status Report - fd6c654 - 2026-05-19 12:19:16 -0500Build
|
This PR fixes the (/at least) two tests that seemed to be failing in the Cyclus build. The two failing tests were:
MaterialTest.AbsorbPrevDecayandResourceTest.MaterialUnitValueMaterialTest.AbsorbPrevDecaywas fixed by adding a fake context to the simulation and then stepping through fakectx->time and checking that absorb records the correct timestamp (should be 11)ResourceTest.MaterialUnitValuewas failing because when you made the change in thematerial.ccAbsorbfunction you accidentally deleted the part that averages the unit value of combined materials. I added that bit back and this test started passing! I guess this just goes to show why tests are so valuable! 😁Either way, this PR should fix at least those two tests, and they were the ones I saw that were failing in your Cyclus PR, so hopefully this fixes that and then we're good to go!