@@ -32,6 +32,7 @@ def _get_test_invoice(
3232 institution = None ,
3333 is_billable = None ,
3434 missing_pi = None ,
35+ clusters = None ,
3536 ):
3637 if not balances :
3738 balances = pi_balances
@@ -48,6 +49,9 @@ def _get_test_invoice(
4849 if not missing_pi :
4950 missing_pi = [False for _ in range (len (pi ))]
5051
52+ if not clusters :
53+ clusters = ["" for _ in range (len (pi ))]
54+
5155 return pandas .DataFrame (
5256 {
5357 "Manager (PI)" : pi ,
@@ -57,6 +61,7 @@ def _get_test_invoice(
5761 "Institution" : institution ,
5862 "Is Billable" : is_billable ,
5963 "Missing PI" : missing_pi ,
64+ "Cluster Name" : clusters ,
6065 }
6166 )
6267
@@ -175,3 +180,21 @@ def test_two_pi(self):
175180 answer_invoice ["PI Balance" ] = [0 , 60 , 0 , 0 ]
176181
177182 self ._assert_result_invoice (subsidy_amount , test_invoice , answer_invoice )
183+
184+ def test_exclude_bm_cluster (self ):
185+ """Projects in the 'bm' cluster should be excluded from BU subsidy calculation."""
186+ subsidy_amount = 100
187+ test_invoice = self ._get_test_invoice (
188+ ["PI" ] * 2 , # single PI (will be broadcast to two rows by lengths below)
189+ pi_balances = [60 , 60 ],
190+ project_names = ["P1" , "P2" ],
191+ clusters = ["bm" , "ocp" ],
192+ )
193+
194+ answer_invoice = test_invoice .copy ()
195+ answer_invoice ["Project" ] = answer_invoice ["Project - Allocation" ]
196+ # bm allocation gets no subsidy, non-bm allocation gets up to its PI balance (60)
197+ answer_invoice ["Subsidy" ] = [0 , 60 ]
198+ answer_invoice ["PI Balance" ] = [60 , 0 ]
199+
200+ self ._assert_result_invoice (subsidy_amount , test_invoice , answer_invoice )
0 commit comments