Skip to content

Add comprehensive test coverage for the image-processing library #4

@uxabix

Description

@uxabix

Description

Introduce a complete automated test suite to ensure the correctness, stability, and long-term maintainability of the image-processing library.
Tests should cover arithmetic operations, filters, decorators, histogram tools, thresholding methods, and utility functions.

The goal is to create a reliable safety net that prevents regressions as the project evolves.


Requirements

1. Testing Framework

  • Use pytest as the main testing framework.
  • Organize tests in a dedicated directory

2. What Should Be Tested?

Core arithmetic operations (add, multiply, divide, etc.)
  • Handle both grayscale and RGB images.
  • Clamp results properly.
  • Maintain image shape and dtype.
Filters (mean, Gaussian, sharpening, Sobel, median)
  • Test correct kernel application.
  • Check that invalid parameters are handled gracefully.
  • Validate output dtype and value ranges.
Decorators
  • Ensure decorators correctly:
  • apply per-channel logic,
  • perform clamping,
  • convert output to uint8.
Histogram tools
  • Histogram stretching correctness.
  • Histogram equalization shape & range consistency.
Thresholding methods
  • Manual thresholding returns expected binary masks.
  • Percentage thresholding uses correct percentile.
  • Otsu method selects correct threshold for simple synthetic images.
Utilities
  • Image loading/saving wrappers (mocked).
  • Validation helpers if they exist.

3. Additional Requirements

  • Achieve at least 80% coverage (preferably higher).
  • Add a GitHub Actions workflow for:
    • Running tests,
    • Checking coverage,
    • Blocking PRs if tests fail.

Note

Tests should be deterministic — avoid random or non-repeatable inputs unless seeded.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions