Skip to content

Commit

Permalink
Merge pull request #114 from QuanMPhm/remove_mutables
Browse files Browse the repository at this point in the history
Removed mutable defaults from function signatures in `tests/util.py`
  • Loading branch information
QuanMPhm authored Nov 19, 2024
2 parents 2bfabc5 + 0c00c58 commit 5ad8e4c
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions process_report/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,28 @@
def new_base_invoice(
name="",
invoice_month="0000-00",
data=pandas.DataFrame(),
data=None,
):
if data is None:
data = pandas.DataFrame()
return invoice.Invoice(name, invoice_month, data)


def new_billable_invoice(
name="",
invoice_month="0000-00",
data=pandas.DataFrame(),
data=None,
nonbillable_pis=None,
nonbillable_projects=None,
old_pi_filepath="",
limit_new_pi_credit_to_partners=False,
):
if data is None:
data = pandas.DataFrame()
if nonbillable_pis is None:
nonbillable_pis = []
if nonbillable_projects is None:
nonbillable_projects = []
return billable_invoice.BillableInvoice(
name,
invoice_month,
Expand All @@ -40,8 +50,10 @@ def new_billable_invoice(


def new_bu_internal_invoice(
name="", invoice_month="0000-00", data=pandas.DataFrame(), subsidy_amount=0
name="", invoice_month="0000-00", data=None, subsidy_amount=0
):
if data is None:
data = pandas.DataFrame()
return bu_internal_invoice.BUInternalInvoice(
name, invoice_month, data, subsidy_amount
)
Expand All @@ -50,8 +62,10 @@ def new_bu_internal_invoice(
def new_pi_specific_invoice(
name="",
invoice_month="0000-00",
data=pandas.DataFrame(),
data=None,
):
if data is None:
data = pandas.DataFrame()
return pi_specific_invoice.PIInvoice(
name,
invoice_month,
Expand All @@ -62,20 +76,28 @@ def new_pi_specific_invoice(
def new_add_institution_processor(
name="",
invoice_month="0000-00",
data=pandas.DataFrame(),
data=None,
):
if data is None:
data = pandas.DataFrame()
return add_institution_processor.AddInstitutionProcessor(name, invoice_month, data)


def new_validate_pi_alias_processor(
name="", invoice_month="0000-00", data=pandas.DataFrame(), alias_map={}
name="", invoice_month="0000-00", data=None, alias_map=None
):
if data is None:
data = pandas.DataFrame()
if alias_map is None:
alias_map = {}
return validate_pi_alias_processor.ValidatePIAliasProcessor(
name, invoice_month, data, alias_map
)


def new_lenovo_processor(name="", invoice_month="0000-00", data=pandas.DataFrame()):
def new_lenovo_processor(name="", invoice_month="0000-00", data=None):
if data is None:
data = pandas.DataFrame()
return lenovo_processor.LenovoProcessor(name, invoice_month, data)


Expand Down

0 comments on commit 5ad8e4c

Please sign in to comment.