Updated files to support py3

This commit is contained in:
Stephen M. McQuay
2012-05-29 17:33:28 -06:00
parent 2355deec9f
commit d05b5164b2
6 changed files with 19 additions and 15 deletions
+3 -2
View File
@@ -12,8 +12,9 @@ class TestEdge(unittest.TestCase):
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')
cube_json = json.load(open(self.cube_file_name, 'r'))
self.cube = PolygonMesh(**cube_json)
with open(self.cube_file_name, 'r') as cube_file:
cube_json = json.load(cube_file)
self.cube = PolygonMesh(**cube_json)
def test_centroid(self):
e = self.cube.edges[0]
+3 -2
View File
@@ -11,8 +11,9 @@ class TestPM(unittest.TestCase):
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')
self.cube = json.load(open(self.cube_file_name, 'r'))
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)
+7 -5
View File
@@ -12,18 +12,20 @@ class TestCC(unittest.TestCase):
path, file_name = os.path.split(__file__)
self.samples_dir = os.path.join(path, os.pardir, os.pardir, os.pardir,
'blender', 'samples')
self.cube_file_name = os.path.join(self.samples_dir, 'cube.json')
self.cube = json.load(open(self.cube_file_name, 'r'))
self.cube_file_name = os.path.join(self.samples_dir,
cube_file_name = os.path.join(self.samples_dir, 'cube.json')
with open(cube_file_name, 'r') as cube_file:
self.cube = json.load(cube_file)
cube_file_name = os.path.join(self.samples_dir,
'cube-blender-cc-1.json')
self.cube1 = json.load(open(self.cube_file_name, 'r'))
with open(cube_file_name, 'r') as cube_file:
self.cube1 = json.load(cube_file)
def test_refined_vertex_location(self):
p = PolygonMesh(**self.cube)
p2 = cc.refine(p)
v2 = [list(i) for i in p2.vertices]
for a, b in zip(sorted(self.cube1['vertices']), sorted(v2)):
for i in xrange(len(a)):
for i in range(len(a)):
self.assertAlmostEqual(a[i], b[i])
def test_vert_count(self):
+2 -2
View File
@@ -2,10 +2,10 @@ from surf.util import cube
from surf.subd import cc
polygon = cube()
print polygon
print(polygon)
refined_poly = cc.refine(polygon)
print refined_poly
print(refined_poly)
#
#
# import pylab