Skip to content

Commit

Permalink
Test Parameters from ParameterCollection.where pass the filter function
Browse files Browse the repository at this point in the history
  • Loading branch information
drewj-tp committed Sep 20, 2024
1 parent 83e126f commit 18e5219
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions armi/reactor/tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ def test_onCategory(self):
for p in self.pc.where(
lambda pd: pd.hasCategory(parameters.Category.neutronics)
):
self.assertTrue(p.hasCategory(parameters.Category.neutronics), msg=p)
names.remove(p.name)
self.assertFalse(names, msg=f"{names=} should be empty!")

Expand All @@ -570,16 +571,21 @@ def test_onLocation(self):
for p in self.pc.where(
lambda pd: pd.atLocation(parameters.ParamLocation.EDGES)
):
self.assertTrue(p.atLocation(parameters.ParamLocation.EDGES), msg=p)
names.remove(p.name)
self.assertFalse(names, msg=f"{names=} should be empty!")

def test_complicated(self):
names = {
"cornerFlux",
}
for p in self.pc.where(
lambda pd: pd.atLocation(parameters.ParamLocation.CORNERS)
and pd.hasCategory(parameters.Category.neutronics)
):

def check(p: parameters.Parameter) -> bool:
return p.atLocation(parameters.ParamLocation.CORNERS) and p.hasCategory(
parameters.Category.neutronics
)

for p in self.pc.where(check):
self.assertTrue(check(p), msg=p)
names.remove(p.name)
self.assertFalse(names, msg=f"{names=} should be empty")

0 comments on commit 18e5219

Please sign in to comment.