Skip to content

Fix Raster.__rtruediv__ computing operands in wrong order - #425

Merged
nathanjmcdougall merged 7 commits into
developfrom
copilot/fix-raster-division-operation
Mar 2, 2026
Merged

Fix Raster.__rtruediv__ computing operands in wrong order#425
nathanjmcdougall merged 7 commits into
developfrom
copilot/fix-raster-division-operation

Conversation

Copilot AI commented Mar 2, 2026

Copy link
Copy Markdown
Contributor
  • Fix Raster.__rtruediv__ to compute other / self.arr instead of self / other
  • Add isinstance(other, float | int) check and return NotImplemented fallback to match __truediv__ type handling
  • Remove unnecessary Raster branch from __rtruediv__ (handled by __truediv__)
  • Refactor __rtruediv__ to use early-exit guard to reduce indentation
  • Change early-exit guard to return NotImplemented instead of raise NotImplementedError
  • Fix the existing test_right_div_float test to assert the correct values for 2.0 / raster
Original prompt

This section details on the original issue you should resolve

<issue_title>Raster.__rtruediv__ flips the division operation around the wrong way</issue_title>
<issue_description></issue_description>

<agent_instructions>Fix this issue and write tests</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: b-j-karl <119374704+b-j-karl@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix division operation in Raster.__rtruediv__ method Fix Raster.__rtruediv__ computing operands in wrong order Mar 2, 2026
Comment thread src/rastr/raster.py
Co-authored-by: b-j-karl <119374704+b-j-karl@users.noreply.github.com>
Comment thread src/rastr/raster.py Outdated
Co-authored-by: b-j-karl <119374704+b-j-karl@users.noreply.github.com>
Comment thread src/rastr/raster.py Outdated
Co-authored-by: b-j-karl <119374704+b-j-karl@users.noreply.github.com>
@b-j-karl
b-j-karl marked this pull request as ready for review March 2, 2026 22:23
Comment thread src/rastr/raster.py Outdated
Comment thread src/rastr/raster.py
Co-authored-by: b-j-karl <119374704+b-j-karl@users.noreply.github.com>
Comment thread src/rastr/raster.py Outdated
Comment thread src/rastr/raster.py Outdated
Co-authored-by: b-j-karl <119374704+b-j-karl@users.noreply.github.com>
@t-t-sonarqube

t-t-sonarqube Bot commented Mar 2, 2026

Copy link
Copy Markdown

@nathanjmcdougall
nathanjmcdougall merged commit 8ec17a1 into develop Mar 2, 2026
15 checks passed
@nathanjmcdougall
nathanjmcdougall deleted the copilot/fix-raster-division-operation branch March 2, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raster.__rtruediv__ flips the division operation around the wrong way

3 participants