added another Vertex division test

This commit is contained in:
Stephen M. McQuay 2012-05-15 17:25:11 -06:00
parent 544a570629
commit 66a688fa75
1 changed files with 15 additions and 1 deletions

View File

@ -25,11 +25,25 @@ class TestVertex(unittest.TestCase):
v = sum((self.v1, self.v2, self.v3, self.v4, self.v5), Vertex())
self.assertEqual(v, Vertex(11, 17.3, 116))
def test_division(self):
def test_float_int_division(self):
v1 = self.v1 / 2
v2 = self.v1 / 2.0
self.assertEqual(v1, v2)
def test_division(self):
v1 = Vertex(36, 12, 48)
v2 = v1 / 12
self.assertEqual(v2, Vertex(3, 1, 4))
v1 = Vertex(36.0, 12.0, 48.0)
v2 = v1 / 12.0
self.assertEqual(v2, Vertex(3.0, 1.0, 4.0))
v1 = Vertex(36, 12, 48)
v2 = v1 / 12.0
self.assertEqual(v2, Vertex(3, 1, 4))
v1 = Vertex(36., 12., 48.)
v2 = v1 / 12
self.assertEqual(v2, Vertex(3.0, 1.0, 4.0))
def test_inappropriate_division(self):
with self.assertRaises(TypeError):
self.v1 / self.v2