test_triangle.py 645 B

12345678910111213141516171819202122232425
  1. import pytest
  2. from freesurfer_surface import Triangle
  3. def test_init():
  4. triangle = Triangle((0, 21, 42))
  5. assert triangle.vertex_indices == (0, 21, 42)
  6. def test_init_invalid_indices_len():
  7. with pytest.raises(Exception):
  8. Triangle((0, 21, 42, 84))
  9. def test_eq():
  10. assert Triangle((0, 1, 2)) == Triangle((0, 1, 2))
  11. # pylint: disable=unneeded-not
  12. assert not Triangle((0, 1, 2)) == Triangle((0, 1, 4))
  13. assert not Triangle((0, 1, 2)) == Triangle((0, 4, 2))
  14. assert not Triangle((0, 1, 2)) == Triangle((4, 1, 2))
  15. def test_repr():
  16. assert repr(Triangle((0, 1, 2))) == 'Triangle(vertex_indices=(0, 1, 2))'