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

signature tests for floor_divide and remainder divide by 0

Open
#170 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by locating the signature tests around _test_uninspectable_func and the cases for remainder and floor_divide. Reproduce the reported inputs with torch.tensor values and inspect array_api_compat/torch/_aliases.py:75. Done means the relevant tests explicitly handle the divide-by-zero behavior without an unexpected test failure.

Written by the indexing model from the issue text.

Description

medium priority

This is a problem for torch, which raises ZeroDivisionError in this case (note that the spec leaves integer division by 0 unspecified).

For example:

x1 = tensor(0, dtype=torch.uint8), x2 = tensor(0, dtype=torch.uint8), kwargs = {}

    @wraps(f)
    def _f(x1, x2, /, **kwargs):
        x1, x2 = _fix_promotion(x1, x2)
>       return f(x1, x2, **kwargs)
E       RuntimeError: ZeroDivisionError
E       Falsifying example: _test_uninspectable_func(
E           data=data(...),
E           func_name='remainder',
E           func=remainder,
E           stub_sig=<Signature (x1: ~array, x2: ~array, /) -> ~array>,
E           array=None,
E       )
E       Draw 1 (x1): tensor(0, dtype=torch.uint8)
E       Draw 2 (x2): tensor(0, dtype=torch.uint8)
E       trying remainder(tensor(0, dtype=torch.uint8), tensor(0, dtype=torch.uint8))

../array-api-compat/array_api_compat/torch/_aliases.py:75: RuntimeError

And similarly for floor_divide.

Dominant language
Python
Stars
74
Forks
54
Avg merge
4h 35m
Merged PRs (30d)
4

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 data-apis/array-api-tests

All issues in data-apis/array-api-tests

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.