You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
451 B
20 lines
451 B
5 years ago
|
import pytest
|
||
|
|
||
|
from clusterview.colors import Color
|
||
|
from clusterview.math import Math
|
||
|
from clusterview.points import Point
|
||
|
|
||
|
|
||
|
def test_euclidean_distance():
|
||
|
p1 = Point(150, 100, Color.BLACK, 8, 800, 600)
|
||
|
p2 = Point(300, 200, Color.BLACK, 8, 800, 600)
|
||
|
|
||
|
d = Math.euclidean_distance(p1, p2)
|
||
|
|
||
|
assert round(d, 2) == 180.28
|
||
|
|
||
|
|
||
|
def test_euclidean_distance_bad_points():
|
||
|
with pytest.raises(ValueError):
|
||
|
Math.euclidean_distance(1, 1)
|