statannotations icon indicating copy to clipboard operation
statannotations copied to clipboard

Annotation test file contains fragile assertions and missing documentation.

Open jaydev-431 opened this issue 2 months ago • 0 comments

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.

jaydev-431 avatar Nov 04 '25 02:11 jaydev-431