Skip to content

Commit

Permalink
test: Actually test subscan analysis result collection [nfc]
Browse files Browse the repository at this point in the history
  • Loading branch information
dnadlinger authored and oitg-bulldozer[bot] committed Jan 9, 2021
1 parent 90644a2 commit b902f09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ def build_fragment(self):
self.setattr_param("b", FloatParam, "b", 0.0)

def get_default_analyses(self):
def analyse(coords, values, results):
next(iter(results.values())).push(42.0)
return []

return [
CustomAnalysis([self.a], lambda *_: []),
CustomAnalysis([self.b], lambda *_: [])
CustomAnalysis([self.a], analyse, [FloatChannel("result_a")]),
CustomAnalysis([self.b], analyse, [FloatChannel("result_b")])
]
8 changes: 6 additions & 2 deletions test/test_experiment_subscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ def run_once(self):


class SubscanAnalysisCase(ExpFragmentCase):
def test_analysis_filtering(self):
def test_simple_filtering(self):
parent = self.create(SubscanAnalysisFragment)
run_fragment_once(parent)
results = run_fragment_once(parent)

spec = json.loads(results[parent.scan_spec])
self.assertEqual(spec["analysis_results"], {"result_a": "scan_result_a"})
self.assertEqual(results[parent.scan_result_a], 42.0)

0 comments on commit b902f09

Please sign in to comment.