Implement Unit Testing for fancymath
#8
Reference in New Issue
Block a user
No description provided.
Delete Branch "unit_tests"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implement Unit Testing for `fancymath`to WIP: Implement Unit Testing for `fancymath`This looks pretty good. We should have type checking on
otherin the__add__method and a few more docstrings would be good. Beyond that there are some design issues to consider, but they may not need to be part of this PR.@@ -30,6 +30,20 @@ class Vector(object):s = "Vector(x=%s, y=%s, z=%s)" % (self.x, self.y, self.z)return sdef __add__(self, other):This should handle case where
otheris not aVector.@@ -33,0 +37,4 @@return self.__class__(x, y, z)def __mul__(self, other):if not isinstance(other, Vector):Do we want to handle scalar multiplication here? If so we should implement
__rmul__and__imul__.@@ -0,0 +53,4 @@def test_dot_product(self):v1 = Vector(1, 2, 3)v2 = Vector(-3, -2, -1)v3 = v1.dot(v2)Seeing this in use, perhaps we should use
@for dot product? So we getv1 @ v2. Can we open an issue to discuss this?WIP: Implement Unit Testing for `fancymath`to Implement Unit Testing for `fancymath`The operation for cross product using '*' would confuse users who want to multiply vectors.