|
@@ -1,19 +1,43 @@
|
|
|
import pytest
|
|
|
|
|
|
-from freesurfer_surface import _LineSegment
|
|
|
+from freesurfer_surface import LineSegment
|
|
|
|
|
|
|
|
|
def test_init_fail():
|
|
|
with pytest.raises(Exception):
|
|
|
- _LineSegment((1, 2, 3))
|
|
|
+ LineSegment((1, 2, 3))
|
|
|
|
|
|
|
|
|
def test_eq():
|
|
|
- assert _LineSegment((67018, 67019)) == _LineSegment((67018, 67019))
|
|
|
- assert _LineSegment((67018, 67019)) == _LineSegment((67019, 67018))
|
|
|
- assert _LineSegment((67019, 67018)) == _LineSegment((67018, 67019))
|
|
|
+ assert LineSegment((67018, 67019)) == LineSegment((67018, 67019))
|
|
|
+ assert LineSegment((67018, 67019)) == LineSegment((67019, 67018))
|
|
|
+ assert LineSegment((67019, 67018)) == LineSegment((67018, 67019))
|
|
|
|
|
|
|
|
|
def test_repr():
|
|
|
- assert repr(_LineSegment((67018, 67019))) \
|
|
|
- == '_LineSegment(vertex_indices=(67018, 67019))'
|
|
|
+ assert repr(LineSegment((67018, 67019))) \
|
|
|
+ == 'LineSegment(vertex_indices=(67018, 67019))'
|
|
|
+
|
|
|
+
|
|
|
+def test_adjacent_vertex_indices_1():
|
|
|
+ chain = LineSegment((1, 4))
|
|
|
+ singles = list(chain.adjacent_vertex_indices(1))
|
|
|
+ assert len(singles) == 2
|
|
|
+ assert singles[0] == (1,)
|
|
|
+ assert singles[1] == (4,)
|
|
|
+
|
|
|
+
|
|
|
+def test_adjacent_vertex_indices_2():
|
|
|
+ chain = LineSegment((1, 4))
|
|
|
+ pairs = list(chain.adjacent_vertex_indices(2))
|
|
|
+ assert len(pairs) == 2
|
|
|
+ assert pairs[0] == (1, 4)
|
|
|
+ assert pairs[1] == (4, 1)
|
|
|
+
|
|
|
+
|
|
|
+def test_adjacent_vertex_indices_3():
|
|
|
+ chain = LineSegment((1, 4))
|
|
|
+ triplets = list(chain.adjacent_vertex_indices(3))
|
|
|
+ assert len(triplets) == 2
|
|
|
+ assert triplets[0] == (1, 4, 1)
|
|
|
+ assert triplets[1] == (4, 1, 4)
|