surfaces/surf/test/polymesh.py
2012-05-29 17:33:28 -06:00

28 lines
732 B
Python

import json
import os
import unittest
from surf.geometry import PolygonMesh
class TestPM(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')
cube_file_name = os.path.join(self.samples_dir, 'cube.json')
with open(cube_file_name) as cube_file:
self.cube = json.load(cube_file)
def test_cube_load(self):
p = PolygonMesh(**self.cube)
v = p.vertices[0]
self.assertAlmostEqual(v.x, -1.0)
self.assertAlmostEqual(v.y, -1.0)
self.assertAlmostEqual(v.z, -1.0)
if __name__ == '__main__':
unittest.main(verbosity=3)