Skip to content

Split up test_discount_processor.py into tests for the discount processor and pi-su credit processor#290

Open
marcoagonzales007 wants to merge 1 commit into
CCI-MOC:mainfrom
marcoagonzales007:main
Open

Split up test_discount_processor.py into tests for the discount processor and pi-su credit processor#290
marcoagonzales007 wants to merge 1 commit into
CCI-MOC:mainfrom
marcoagonzales007:main

Conversation

@marcoagonzales007

@marcoagonzales007 marcoagonzales007 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

-Moved test_one_eligible_project_only and test_all_eligible_projects into a new test_pi_su_credit_processor.py because they test the PISUCreditProcessor._process logic

-Kept test_preexisting_credit in test_discount_processor.py

-Added new_pi_su_credit_processor() to tests/util.py to match the other processors

-Updated both of the test files to use test_utils instead of directly using PISUCreditProcessor

Closes Issue #289

@QuanMPhm QuanMPhm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the comment below, can you add your PR description into the commit message as well?

)

processor = PISUCreditProcessor(
processor = test_utils.new_pi_su_credit_processor(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this file only tests the features of DiscountProcessor. You should not be using the New-PI processor here. I would suggest using the DiscountProcessor and call apply_flat_discount() directly instead. Something like this:

processor = DiscountProcessor(data=pandas.Dataframe())
processor.apply_flat_discount(...)
...

You shouldn't need to add an function for DiscountProcessor in util.py, since its only used once here.

@marcoagonzales007 marcoagonzales007 force-pushed the main branch 2 times, most recently from 46aaf3b to 57c6909 Compare April 15, 2026 13:43

@QuanMPhm QuanMPhm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment. Otherwise, looks good!

Comment thread .gitignore Outdated
!process_report/tests/e2e/test_data/test_invoices/*.csv
__pycache__/
*.py[cod]
.vscode/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is something Visual Studio Code added to the repo when you worked on it, in which case I would suggest not putting this here, since it doesn't benefit anyone else developing on this repository. If everyone added things to .gitignore that's specific to their work setup, the file will become messy quick.

If you want a personal ignore rules for your fork, I'd suggest something described here

- Moved test_one_eligible_project_only and test_all_eligible_projects into new test_pi_su_credit_processor.py
- Kept test_preexisting_credit in test_discount_processor.py, using DiscountProcessor directly
- Added new_pi_su_credit_processor() factory to tests/util.py
@QuanMPhm QuanMPhm requested review from knikolla and naved001 April 22, 2026 16:15
@QuanMPhm

QuanMPhm commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

@knikolla @naved001 Looks good to me. Just a pass from either of you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants