PEP 8
[linpy.git] / linpy / tests / test_geometry.py
index 0f3884c..faa20df 100644 (file)
@@ -18,7 +18,7 @@
 import math
 import unittest
 
-from ..geometry import *
+from ..geometry import Point, Vector
 from ..linexprs import Symbol
 from ..polyhedra import Eq
 
@@ -37,7 +37,7 @@ class TestPoint(unittest.TestCase):
     def test_new(self):
         self.assertEqual(Point({self.x: 10, self.y: 5, self.z: 1}), self.pt1)
         self.assertEqual(Point([(self.x, 10), (self.y, 5), (self.z, 1)]),
-            self.pt1)
+                         self.pt1)
 
     def test_symbols(self):
         self.assertTupleEqual(self.pt1.symbols, (self.x, self.y, self.z))
@@ -57,11 +57,10 @@ class TestPoint(unittest.TestCase):
 
     def test_coordinates(self):
         self.assertListEqual(list(self.pt1.coordinates()),
-            [(self.x, 10), (self.y, 5), (self.z, 1)])
+                             [(self.x, 10), (self.y, 5), (self.z, 1)])
 
     def test_values(self):
-        self.assertListEqual(list(self.pt1.values()),
-            [10, 5, 1])
+        self.assertListEqual(list(self.pt1.values()), [10, 5, 1])
 
     def test_isorigin(self):
         self.assertFalse(self.pt1.isorigin())
@@ -73,15 +72,15 @@ class TestPoint(unittest.TestCase):
 
     def test_add(self):
         self.assertEqual(self.pt1 + self.vec1,
-            Point({self.x: 30, self.y: 35, self.z: 41}))
+                         Point({self.x: 30, self.y: 35, self.z: 41}))
         with self.assertRaises(TypeError):
             self.pt1 + self.pt2
 
     def test_sub(self):
         self.assertEqual(self.pt1 - self.pt2,
-            Vector({self.x: -5, self.y: -35, self.z: -59}))
+                         Vector({self.x: -5, self.y: -35, self.z: -59}))
         self.assertEqual(self.pt1 - self.vec1,
-            Point({self.x: -10, self.y: -25, self.z: -39}))
+                         Point({self.x: -10, self.y: -25, self.z: -39}))
 
     def test_eq(self):
         self.assertEqual(self.pt1, self.pt1)
@@ -90,7 +89,7 @@ class TestPoint(unittest.TestCase):
 
     def test_aspolyhedron(self):
         self.assertEqual(self.pt1.aspolyhedron(),
-            Eq(self.x, 10) & Eq(self.y, 5) & Eq(self.z, 1))
+                         Eq(self.x, 10) & Eq(self.y, 5) & Eq(self.z, 1))
 
     def test_repr(self):
         self.assertEqual(repr(self.pt1), 'Point({x: 10, y: 5, z: 1})')
@@ -108,19 +107,25 @@ class TestVector(unittest.TestCase):
         self.vec2 = Vector({self.x: 45, self.y: 70, self.z: 80})
 
     def test_add(self):
-        self.assertEqual(self.vec1 + self.pt1, Point({self.x: 30, self.y: 35, self.z: 41}))
-        self.assertEqual(self.vec1 + self.vec2, Vector({self.x: 65, self.y: 100, self.z: 120}))
+        self.assertEqual(self.vec1 + self.pt1,
+                         Point({self.x: 30, self.y: 35, self.z: 41}))
+        self.assertEqual(self.vec1 + self.vec2,
+                         Vector({self.x: 65, self.y: 100, self.z: 120}))
 
     def test_angle(self):
         self.assertEqual(math.degrees(self.vec1.angle(self.vec1)), 0)
-        self.assertAlmostEqual(math.degrees(self.vec1.angle(self.vec2)), 4.15129, places=5)
-        self.assertAlmostEqual(math.degrees(self.vec2.angle(self.vec1)), 4.15129, places=5)
+        self.assertAlmostEqual(math.degrees(self.vec1.angle(self.vec2)),
+                               4.15129, places=5)
+        self.assertAlmostEqual(math.degrees(self.vec2.angle(self.vec1)),
+                               4.15129, places=5)
 
     def test_cross(self):
-        self.assertEqual(self.vec1.cross(self.vec2), Vector({self.x: -400, self.y: 200, self.z: 50}))
+        self.assertEqual(self.vec1.cross(self.vec2),
+                         Vector({self.x: -400, self.y: 200, self.z: 50}))
 
     def test_div(self):
-        self.assertEqual(self.vec1 / 10, Vector({self.x: 2, self.y: 3, self.z: 4}))
+        self.assertEqual(self.vec1 / 10,
+                         Vector({self.x: 2, self.y: 3, self.z: 4}))
 
     def test_dot(self):
         self.assertEqual(self.vec1.dot(self.vec2), 6200)
@@ -130,11 +135,14 @@ class TestVector(unittest.TestCase):
         self.assertNotEqual(self.vec1, self.vec2)
 
     def test_mul(self):
-        self.assertEqual(75 * self.vec1, Vector({self.x: 1500, self.y: 2250, self.z: 3000}))
-        self.assertEqual(self.vec1 * 75, Vector({self.x: 1500, self.y: 2250, self.z: 3000}))
+        self.assertEqual(75 * self.vec1,
+                         Vector({self.x: 1500, self.y: 2250, self.z: 3000}))
+        self.assertEqual(self.vec1 * 75,
+                         Vector({self.x: 1500, self.y: 2250, self.z: 3000}))
 
     def test_neg(self):
-        self.assertEqual(-self.vec1, Vector({self.x: -20, self.y: -30, self.z: -40}))
+        self.assertEqual(-self.vec1,
+                         Vector({self.x: -20, self.y: -30, self.z: -40}))
 
     def test_norm(self):
         self.assertAlmostEqual(self.vec1.norm(), 53.85165, places=5)
@@ -149,5 +157,7 @@ class TestVector(unittest.TestCase):
         self.assertAlmostEqual(unit[self.z], 0.74278, 5)
 
     def test_sub(self):
-        self.assertEqual(self.vec1 - self.pt1, Point({self.x: 10, self.y: 25, self.z: 39}))
-        self.assertEqual(self.vec1 - self.vec2, Vector({self.x: -25, self.y: -40, self.z: -40}))
+        self.assertEqual(self.vec1 - self.pt1,
+                         Point({self.x: 10, self.y: 25, self.z: 39}))
+        self.assertEqual(self.vec1 - self.vec2,
+                         Vector({self.x: -25, self.y: -40, self.z: -40}))