import unittest from phase2_b13_e1b import pooled,branch_decision class FullRosterTests(unittest.TestCase): def test_invalid_G_not_filtered_from_gate(self): metric=lambda x:{k:dict(value=x,reason=None) for k in ['relative_l2','last_location','kendall_tau_b']} rows=[dict(component_id=str(i),G_valid=i<102,new=metric(.9 if i<102 else 3),A=metric(1)) for i in range(204)] result=pooled(rows);self.assertEqual(result['relative_l2']['components']['new'],204);self.assertEqual(branch_decision(result),'NOT_CONFIRMED_FIXED_RECIPE');self.assertLess(pooled(rows[:102])['relative_l2']['new_minus_A']['high'],0) def test_full204_required_and_strict_bound(self): m=lambda n,h:dict(relative_l2=dict(components=dict(new=n,A=n),new_minus_A=dict(high=h))) self.assertEqual(branch_decision(m(203,-1)),'PARK_UNDEFINED');self.assertEqual(branch_decision(m(204,0)),'NOT_CONFIRMED_FIXED_RECIPE');self.assertEqual(branch_decision(m(204,-1e-12)),'CONFIRMED_FIXED_GENERIC_CONTEXT_INCREMENT') if __name__=='__main__':unittest.main()