Skip to content
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

raise ValueError when Magnitude of Vector is 0 #38

Merged
merged 2 commits into from
Jul 18, 2018

Conversation

arihantparsoya
Copy link
Member

Fixes #37.

Added test condition in line 376 to raise ValueError when magnitude of vector is 0.

>>> from p5 import *
>>> x = Vector(0, 0)
>>> print(x.magnitude)
0.0
>>> x.normalize()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/arihantparsoya/Documents/p5/p5/pmath/vector.py", line 368, in normalize
    raise ValueError('Cannot normalize vector with magnitude 0')
ValueError: Cannot normalize vector having magnitude 0

Fixes p5py#37.

Added test condition in line 376 to raise ValueError when magnitude of vector is 0.
@abhikpal
Copy link
Member

Looks good 👍 Have merged into develop

@abhikpal abhikpal added this to the Pre-VisPy release milestone Jun 5, 2018
@abhikpal abhikpal self-assigned this Jun 5, 2018
@abhikpal abhikpal modified the milestones: Pre-VisPy release, Port backend to VisPy Jun 12, 2018
@abhikpal abhikpal merged commit 333b37a into p5py:master Jul 18, 2018
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.

2 participants