surfaces/surf/test/test_edge.py

27 lines
727 B
Python
Raw Normal View History

import json
import os
2012-05-07 22:17:46 -07:00
import unittest
from surf.geometry import Vertex, PolygonMesh
2012-05-07 22:17:46 -07:00
class TestEdge(unittest.TestCase):
def setUp(self):
path, file_name = os.path.split(__file__)
self.samples_dir = os.path.join(path, os.pardir, os.pardir,
'blender', 'samples')
self.cube_file_name = os.path.join(self.samples_dir, 'cube.json')
2012-05-29 16:33:28 -07:00
with open(self.cube_file_name, 'r') as cube_file:
cube_json = json.load(cube_file)
self.cube = PolygonMesh(**cube_json)
2012-05-07 22:17:46 -07:00
def test_centroid(self):
e = self.cube.edges[0]
v = self.cube.centroid(e)
self.assertEqual(v, Vertex(-1, 0, 1))
2012-05-07 22:17:46 -07:00
if __name__ == '__main__':
unittest.main(verbosity=3)