Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ppb_vector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class Vector:
x: float
y: float

# Class-level attributes
zero: typing.ClassVar['Vector']

__match_args__ = ('x', 'y')

# Tell CPython that this isn't an extendable dict
Expand Down Expand Up @@ -574,4 +577,7 @@ def reflect(self, surface_normal: VectorLike) -> 'Vector':
return self - (2 * (self * surface_normal) * surface_normal)


Vector.zero = Vector(0, 0)


Sequence.register(Vector)
5 changes: 5 additions & 0 deletions tests/test_zero.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ppb_vector import Vector


def test_zero():
assert not Vector.zero