Skip to content

Annotation test file contains fragile assertions and missing documentation. #183

@jaydev-431

Description

@jaydev-431

The current unit tests for the Annotation class in test_annotation.py are functional but need improvements for reliability and clarity.

Issues Identified:

assertRaisesRegex in test_missing_formatter may fail due to strict matching of exception message ("PValueFormat").

Missing docstrings and explanations for individual test methods.

Unused variable (annotation) in test_check_data_stat_result reduces code clarity.

Imports from statannotations may fail if the module path is not properly configured.

No additional checks for edge cases such as None or invalid data in StatResult.

Proposed Fixes:

Replace assertRaisesRegex with assertRaises or use more flexible regex.

Add docstrings explaining the purpose of each test case.

Remove redundant variable declarations to make the tests concise.

Ensure proper import paths (use relative imports if necessary).

Expand test coverage to include invalid or boundary input scenarios.

Expected Outcome:

More stable test suite with clearer purpose and reduced false negatives.

Easier maintenance and readability for future contributors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions