Skip to content

BUG: fix typo in polydiv that prevented promotion to poly1d - #17053

Merged
rossbar merged 4 commits into
numpy:masterfrom
jakobjakobson13:cleanup_polynomial
Aug 18, 2020
Merged

rossbar merged 4 commits into
numpy:masterfrom
jakobjakobson13:cleanup_polynomial

Conversation

@jakobjakobson13

@jakobjakobson13 jakobjakobson13 commented Aug 11, 2020 •

Copy link
Copy Markdown
Contributor

See #17012 item 16.

Closes #17076

Comment thread numpy/lib/polynomial.py
@eric-wieser eric-wieser changed the title simplify "or" statement BUG: fix typo in polydiv that prevented promotion to poly1d Aug 11, 2020
@eric-wieser

Copy link
Copy Markdown
Member

It might be good to add a test for the return type of polydiv(some_arr, some_poly), which this patch changes.

@Dahlia-Chehata

Copy link
Copy Markdown

closes #17076

@eric-wieser

Copy link
Copy Markdown
Member

@Dahlia-Chehata: Not sure it was really worth opening an issue about that given we already have the patch, but no harm done.

@Dahlia-Chehata

Copy link
Copy Markdown

@eric-wieser you are right, but I discovered this PR after I already had opened the issue.

Comment thread numpy/lib/tests/test_polynomial.py Outdated
Comment on lines +250 to +251
assert_equal(isinstance(s, np.poly1d) == True)
assert_equal(isinstance(t, np.poly1d) == True)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert_equal(isinstance(s, np.poly1d) == True)
assert_equal(isinstance(t, np.poly1d) == True)
assert isinstance(s, np.poly1d)
assert isinstance(t, np.poly1d)

Comment thread numpy/lib/tests/test_polynomial.py Outdated
Comment on lines +247 to +249
d = np.poly1d([1, 2, 3])
c = [1, 2, 3]
s, t = np.polydiv(d, c)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is backwards - its the one that passed before this patch.

Probably fine to keep it, but you should add one with the arguments in the other order too.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @jakobjakobson13

@rossbar
rossbar merged commit 0dc5588 into numpy:master Aug 18, 2020
@jakobjakobson13
jakobjakobson13 deleted the cleanup_polynomial branch August 18, 2020 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Typo in numpy.polydiv

4 participants