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

Unit tests for equity module #36

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

countvajhula
Copy link
Contributor

These are quite rough. It would be good to review the interfaces to see if they could be further simplified so that these tests could be leaner as well.

Public Domain Dedication

  • In contributing, I relinquish any copyright claims on my contribution and freely release it into the public domain in the simple hope that it will provide value.

(Why: The freely released, copyright-free work in this repository represents an investment in a better way of doing things called attribution-based economics. Attribution-based economics is based on the simple idea that we gain more by giving more, not by holding on to things that, truly, we could only create because we, in our turn, received from others. As it turns out, an economic system based on attribution -- where those who give more are more empowered -- is significantly more efficient than capitalism while also being stable and fair (unlike capitalism, on both counts), giving it transformative power to elevate the human condition and address the problems that face us today along with a host of others that have been intractable since the beginning. You can help make this a reality by releasing your work in the same way -- freely into the public domain in the simple hope of providing value. Learn more about attribution-based economics at drym.org, tell your friends, do your part.)

@coveralls
Copy link

Pull Request Test Coverage Report for Build 12441522083

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 96.992%

Totals Coverage Status
Change from base Build 12153738345: 0.005%
Covered Lines: 461
Relevant Lines: 472

💛 - Coveralls

@pytest.mark.parametrize(
"prior_contribution, incoming_amount, price, expected_investment",
[
(Decimal("0"), Decimal("0"), Decimal("100"), Decimal("0")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: are all of these cases actually testing different logic / use cases? Do we need them all? Might be helpful to add a comment for each one so that if one fails, we can easily identify what is supposed to happen and what logic is broken.

(Decimal("120"), Decimal("20"), Decimal("100"), Decimal("20")),
],
)
@patch('oldabe.money_in.equity.ItemizedPaymentsRepo')
Copy link
Collaborator

Choose a reason for hiding this comment

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

While discussing, we decided to pass Repos into functions instead of patching them in tests.

These are quite rough. It would be good to review the interfaces to
see if they could be further simplified so that these tests could be
leaner as well.
@countvajhula countvajhula changed the base branch from update-unit-tests to main January 15, 2025 04:34
@countvajhula countvajhula marked this pull request as ready for review January 15, 2025 04:35
@countvajhula countvajhula merged commit e2bdf2f into drym-org:main Jan 15, 2025
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.

3 participants