Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add More Test Cases for Edge Cases in Number Operations

Open
#106 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
testing-qa

Research direction

Start by reading and running test_numbers.py, which currently covers standard operations and type checks for integers, booleans, floats, and complex numbers. Add focused tests for the listed division, floating-point, NaN/infinity, complex-number, and mixed-operand cases; done means the new tests pass and document the expected behavior.

Written by the indexing model from the issue text.

Description

The current test_numbers.py file provides comprehensive coverage for standard operations and type checks for integers, booleans, floats, and complex numbers. However, it would be beneficial to add more test cases that cover edge cases and unusual scenarios. For example:

  • Division by zero and its handling (e.g., 1 / 0 raises ZeroDivisionError).
  • Very large and very small floating-point numbers (e.g., underflow/overflow).
  • Operations involving NaN and infinity in floats.
  • Complex number operations with zero imaginary or real parts.
  • Boolean operations with non-boolean operands.

Adding these tests will help ensure robustness and correctness when handling special cases in numerical computations.

Dominant language
Python
Stars
18.3k
Forks
3k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from trekhleb/learn-python

All issues in trekhleb/learn-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.