Skip to content

[FR] Make tests for contributions.py #74

@DiFronzo

Description

@DiFronzo

Is your feature request related to a problem? Please describe.
There are currently no automated tests for contributions.py, making it difficult to ensure that the UserContributions and UserContribution classes and their methods work as intended and to catch regressions during development.

Describe 1~3 use cases of the purposed feature

  • Verify that the UserContributions class can correctly add, retrieve, and summarize user contributions, and that point capping and deduction logic works as expected.
  • Ensure that formatting and summary methods produce the correct output for various scenarios, including edge cases like zero-point contributions or disqualified articles.
  • Confirm that the UserContribution class properties and methods (such as is_negative, article, site, and user) behave correctly.

Describe alternatives you've considered

  • Relying on manual testing or indirect coverage through higher-level tests, but this does not guarantee that all code paths in contributions.py are exercised.
  • Adding only integration tests, which may not catch issues specific to the contribution logic and its interactions with articles, revisions, and rules.

Additional context
Unit tests for contributions.py will help maintain code quality and reliability. Tests could be implemented using pytest or unittest, and should cover both typical and edge-case usage of the contribution management classes and their methods.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions