Vertex now uses true division instead of casting RHS to float

- updated tests
This commit is contained in:
Stephen M. McQuay
2012-03-22 10:09:14 -06:00
parent c1f7ee46bc
commit a4d9129d77
2 changed files with 11 additions and 3 deletions
+9 -2
View File
@@ -1,6 +1,6 @@
import unittest
from surf.geometry import Vertex, cross
from surf.geometry import Vertex
class TestVertexOperations(unittest.TestCase):
@@ -30,6 +30,14 @@ class TestVertexOperations(unittest.TestCase):
v2 = self.v1 / 2.0
self.assertEqual(v1, v2)
def test_inappropriate_division(self):
with self.assertRaises(TypeError):
self.v1 / self.v2
with self.assertRaises(TypeError):
1.0 / self.v1
with self.assertRaises(TypeError):
self.v1 / 'asdf'
def test_multiply(self):
self.assertEqual(type(self.v1 * 2), Vertex)
self.assertEqual(type(self.v1 * self.v1), Vertex)
@@ -37,7 +45,6 @@ class TestVertexOperations(unittest.TestCase):
self.assertEqual(self.v1 * self.v1, Vertex(0, 0, 0))
self.assertEqual(self.v1 * self.v2, Vertex(0, 0, 0))
self.assertEqual(self.v3 * self.v4, Vertex(58, -35, -50))
def test_cross(self):
i = Vertex(1, 0, 0)