Skip to content

fixed asscalar error on floats #10659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Conversation

prateeks92
Copy link

fixed error encountered on passing floats to asscalar().

done at HackIllinois 2018

@eric-wieser
Copy link
Member

This fixes #4701, I think

@eric-wieser
Copy link
Member

Duplicates #10256, #5126

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

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

See #5126 (comment) where it was suggested to just leave things as is. If we do that, we should at least close the issue! Though I think we might as well just apply this fix, and add the test (see in-line comments).

class TestAsScalar(object):

def test_basic(self):
a = asscalar(np.array([1]))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use np.asscalar

def test_basic(self):
a = asscalar(np.array([1]))
assert_equal(a.__class__, int)
assert_raises(ValueError, asscalar,[1,2])
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add spaces after , (pep8)

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.

4 participants