Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1] - added tests for winners_and_losers #32

Merged

Conversation

masterismail
Copy link
Collaborator

No description provided.

@masterismail masterismail changed the title added tests for winners_and_losers [1] - added tests for winners_and_losers Aug 20, 2024
@anth-volk anth-volk self-requested a review August 31, 2024 17:18
Copy link

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

Thanks for this, @masterismail. Most of this looks good, but I want to confirm one thing. For the winners and losers and deciles tests, it looks like you code a particular tax change, then check the decile output against a hard-coded series of values.

If this is correct, this would make the tests extremely fragile. Because of the complex interaction effects tax policy creates, it wouldn't be surprising if these tests failed, say, a few months down the road because the UK changed how it calculated some particular benefit program. If that's the case, I'd ask that you rewrite these, but I'm not quite sure how yet - I'll leave that in a separate comment.

@anth-volk
Copy link

What I would instead do, if possible, is inject particular values that you expect to return a particular result. For example, for ByIncomeDecile, I would actually define a baseline and reform array (assuming these take arrays) and then either create a tax change for test purposes that just assesses some sort of flat tax or predictably modifies one thing, but isn't present within the overall UK tax & benefit system. Then, I'd test that data and ensure that it returns the expected change.

@anth-volk
Copy link

Changing the status of this to change requested

@anth-volk anth-volk self-requested a review August 31, 2024 17:29
Copy link

@anth-volk anth-volk left a comment

Choose a reason for hiding this comment

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

See comments above

@MaxGhenis
Copy link
Contributor

We also don't want the test suite to require restricted data. Would this run over a synthetic file? Or how about creating a simple fake country system for these tests? @nikhilwoodruff

@masterismail
Copy link
Collaborator Author

Absolutely, @anth-volk. You’re right—I had a similar conversation with Nikhil about this. We also recognized the fragility of these tests and mentioned it during our meeting. The current tests were really just a temporary solution to ensure that the overall package workflow was functioning correctly for the metrics we defined.

given that we also need to consider that the test suite don't have restricted data, creating a specific country system for testing is a good idea. It could also benefit other packages. Thanks so much for bringing this up!

@@ -0,0 +1,19 @@
# Winners and Losers by income
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this to a US test?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there any specific parameter you would recommend that could impact our target metrics ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated with the requested parameter, although we still have zeroes at some places.

@nikhilwoodruff nikhilwoodruff merged commit 22c36fc into PolicyEngine:main Sep 25, 2024
1 check passed
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.

4 participants