Allow comparison between Position and Tuple
Fixes longstanding type error.
This commit is contained in:
parent
7d3b8fcec3
commit
c787d1408f
@ -58,6 +58,9 @@ class Position:
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, Position) and self.x == other.x and self.y == other.y
|
||||
|
||||
def __lt__(self, other):
|
||||
return self[0] < other[0] and self[1] < other[1]
|
||||
|
||||
|
||||
class MatrixProjection(Constraint):
|
||||
def __init__(self, pos: Position, matrix: Matrix):
|
||||
|
@ -17,6 +17,12 @@ def test_position(position):
|
||||
assert position[1] == pos.y
|
||||
|
||||
|
||||
def test_position_can_compare_with_tuple():
|
||||
pos = Position(3, 3)
|
||||
|
||||
assert pos < (4, 4)
|
||||
|
||||
|
||||
def test_matrix_projection_exposes_variables():
|
||||
proj = MatrixProjection(Position(0, 0), Matrix())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user