Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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