@@ -47,6 +47,28 @@ def test_tags_list_to_dict_conversion(self):
4747 self .assertIsInstance (metric .tags , dict )
4848 self .assertEqual (metric .tags , {"tag_1" : "tag1" , "tag_2" : "tag2" , "tag_3" : "tag3" })
4949
50+ def test_tags_property (self ):
51+ """test that QualityControl.tags returns all unique tag values"""
52+ tags = quality_control .tags
53+ self .assertIsInstance (tags , list )
54+ self .assertIn ("Probe A" , tags )
55+ self .assertIn ("Probe B" , tags )
56+ self .assertIn ("Probe C" , tags )
57+ self .assertIn ("Video 1" , tags )
58+ self .assertIn ("Video 2" , tags )
59+ self .assertEqual (len (tags ), 5 )
60+
61+ def test_tag_pairs_property (self ):
62+ """test that QualityControl.tag_pairs returns all unique key:value pairs"""
63+ tag_pairs = quality_control .tag_pairs
64+ self .assertIsInstance (tag_pairs , list )
65+ self .assertIn ("probe:Probe A" , tag_pairs )
66+ self .assertIn ("probe:Probe B" , tag_pairs )
67+ self .assertIn ("probe:Probe C" , tag_pairs )
68+ self .assertIn ("video:Video 1" , tag_pairs )
69+ self .assertIn ("video:Video 2" , tag_pairs )
70+ self .assertEqual (len (tag_pairs ), 5 )
71+
5072 def test_overall_status (self ):
5173 """test that overall status goes to pass/pending/fail correctly"""
5274
@@ -186,7 +208,7 @@ def test_evaluation_status(self):
186208 )
187209 )
188210
189- self .assertEqual (qc .evaluate_status (tag = "Drift map" ), Status .FAIL )
211+ self .assertEqual (qc .evaluate_status (tag = "group: Drift map" ), Status .FAIL )
190212
191213 def test_allowed_failed_metrics (self ):
192214 """Test that if you set the flag to allow failures that tags pass"""
@@ -224,17 +246,17 @@ def test_allowed_failed_metrics(self):
224246 default_grouping = ["group" ],
225247 )
226248
227- self .assertEqual (qc .evaluate_status (tag = "Drift map" ), Status .PENDING )
249+ self .assertEqual (qc .evaluate_status (tag = "group: Drift map" ), Status .PENDING )
228250
229251 # Replace the pending evaluation with a fail, evaluation should not evaluate to pass
230252 qc .metrics [1 ].status_history [0 ].status = Status .FAIL
231253
232- self .assertEqual (qc .evaluate_status (tag = "Drift map" ), Status .FAIL )
254+ self .assertEqual (qc .evaluate_status (tag = "group: Drift map" ), Status .FAIL )
233255
234256 # Now add the tag to allow_tag_failures
235- qc .allow_tag_failures = ["Drift map" ]
257+ qc .allow_tag_failures = ["group: Drift map" ]
236258
237- self .assertEqual (qc .evaluate_status (tag = "Drift map" ), Status .PASS )
259+ self .assertEqual (qc .evaluate_status (tag = "group: Drift map" ), Status .PASS )
238260
239261 def test_metric_history_order (self ):
240262 """Test that the order of the metric status history list is preserved when dumping"""
@@ -441,10 +463,10 @@ def test_status_filters(self):
441463 "behavior" : Status .FAIL ,
442464 "behavior-videos" : Status .PENDING ,
443465 "ecephys" : Status .PASS ,
444- # Tags
445- "test_group" : Status .PASS ,
446- "test_group2" : Status .FAIL ,
447- "tag1" : Status .PENDING ,
466+ # Tags (now in key:value format)
467+ "group: test_group" : Status .PASS ,
468+ "group: test_group2" : Status .FAIL ,
469+ "type: tag1" : Status .PENDING ,
448470 },
449471 )
450472
@@ -454,7 +476,7 @@ def test_status_filters(self):
454476 self .assertEqual (q .evaluate_status (modality = [Modality .ECEPHYS , Modality .BEHAVIOR ]), Status .FAIL )
455477 self .assertEqual (q .evaluate_status (stage = Stage .RAW ), Status .FAIL )
456478 self .assertEqual (q .evaluate_status (stage = Stage .PROCESSING ), Status .PASS )
457- self .assertEqual (q .evaluate_status (tag = "tag1" ), Status .PENDING )
479+ self .assertEqual (q .evaluate_status (tag = "type: tag1" ), Status .PENDING )
458480
459481 def test_status_date (self ):
460482 """QualityControl.status(date=) should return the correct status for the given date"""
@@ -635,7 +657,7 @@ def test_get_filtered_statuses_helper(self):
635657 shared_tag_statuses = _get_filtered_statuses (
636658 metrics = all_metrics ,
637659 date = test_date ,
638- tag_filter = ["shared_tag" ],
660+ tag_filter = ["group: shared_tag" ],
639661 )
640662 self .assertEqual (len (shared_tag_statuses ), 2 ) # Our BEHAVIOR and OPHYS test metrics
641663 self .assertIn (Status .PASS , shared_tag_statuses )
@@ -655,7 +677,7 @@ def test_get_filtered_statuses_helper(self):
655677 time_test_statuses = _get_filtered_statuses (
656678 metrics = all_metrics ,
657679 date = earlier_date ,
658- tag_filter = ["time_test" ],
680+ tag_filter = ["test: time_test" ],
659681 )
660682 self .assertEqual (len (time_test_statuses ), 1 )
661683 self .assertEqual (time_test_statuses [0 ], Status .FAIL ) # Should get the earlier FAIL status
@@ -664,8 +686,8 @@ def test_get_filtered_statuses_helper(self):
664686 ophys_fail_statuses = _get_filtered_statuses (
665687 metrics = all_metrics ,
666688 date = test_date ,
667- tag_filter = ["ophys_tag" ],
668- allow_tag_failures = ["ophys_tag" ],
689+ tag_filter = ["type: ophys_tag" ],
690+ allow_tag_failures = ["type: ophys_tag" ],
669691 )
670692 self .assertEqual (len (ophys_fail_statuses ), 1 )
671693 self .assertEqual (ophys_fail_statuses [0 ], Status .PASS ) # FAIL converted to PASS
@@ -756,16 +778,16 @@ def test_helper_functions_integration(self):
756778 # Test status at different times
757779 early_date = datetime .fromisoformat ("2020-02-01T00:00:00+00:00" )
758780 # At early date: metric 1 is FAIL, metric 2 is PASS -> overall FAIL
759- early_status = qc .evaluate_status (date = early_date , tag = "time_sensitive" )
781+ early_status = qc .evaluate_status (date = early_date , tag = "group: time_sensitive" )
760782 self .assertEqual (early_status , Status .FAIL )
761783
762784 # At test date: metric 1 is PASS, metric 2 is PASS -> overall PASS
763- test_status = qc .evaluate_status (date = test_date , tag = "time_sensitive" )
785+ test_status = qc .evaluate_status (date = test_date , tag = "group: time_sensitive" )
764786 self .assertEqual (test_status , Status .PASS )
765787
766788 # At late date: metric 1 is PASS, metric 2 is FAIL -> overall FAIL
767789 late_date = datetime .fromisoformat ("2020-08-01T00:00:00+00:00" )
768- late_status = qc .evaluate_status (date = late_date , tag = "time_sensitive" )
790+ late_status = qc .evaluate_status (date = late_date , tag = "group: time_sensitive" )
769791 self .assertEqual (late_status , Status .FAIL )
770792
771793 def test_backwards_compatibility_default_grouping (self ):
0 commit comments