Implement Unit Testing for fancymath #8

Merged
TimDiller merged 17 commits from unit_tests into main 2025-10-24 17:10:59 +00:00
Owner
No description provided.
TimDiller added 4 commits 2025-10-24 15:06:42 +00:00
TimDiller changed title from Implement Unit Testing for `fancymath` to WIP: Implement Unit Testing for `fancymath` 2025-10-24 15:07:08 +00:00
david.moody added 1 commit 2025-10-24 15:08:54 +00:00
TimDiller added 1 commit 2025-10-24 15:19:27 +00:00
TimDiller added 4 commits 2025-10-24 15:25:28 +00:00
TimDiller added 5 commits 2025-10-24 15:42:58 +00:00
TimDiller added 2 commits 2025-10-24 16:09:12 +00:00
TimDiller requested review from ambar 2025-10-24 16:59:34 +00:00
TimDiller requested review from corran 2025-10-24 16:59:34 +00:00
TimDiller requested review from david.moody 2025-10-24 16:59:34 +00:00
corran reviewed 2025-10-24 17:05:35 +00:00
corran left a comment
Member

This looks pretty good. We should have type checking on other in 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.

This looks pretty good. We should have type checking on `other` in 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 s
def __add__(self, other):
Member

This should handle case where other is not a Vector.

This should handle case where `other` is not a `Vector`.
@@ -33,0 +37,4 @@
return self.__class__(x, y, z)
def __mul__(self, other):
if not isinstance(other, Vector):
Member

Do we want to handle scalar multiplication here? If so we should implement __rmul__ and __imul__.

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)
Member

Seeing this in use, perhaps we should use @ for dot product? So we get v1 @ v2. Can we open an issue to discuss this?

Seeing this in use, perhaps we should use `@` for dot product? So we get `v1 @ v2`. Can we open an issue to discuss this?
TimDiller changed title from WIP: Implement Unit Testing for `fancymath` to Implement Unit Testing for `fancymath` 2025-10-24 17:08:27 +00:00
Member

The operation for cross product using '*' would confuse users who want to multiply vectors.

The operation for cross product using '*' would confuse users who want to multiply vectors.
TimDiller merged commit e3ffd2210b into main 2025-10-24 17:10:59 +00:00
TimDiller deleted branch unit_tests 2025-10-24 17:10:59 +00:00
Sign in to join this conversation.
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DillerDigitalStudents/DD-SWNG-20251020-V#8
No description provided.