Skip to content

Commit

Permalink
Pylint fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Dec 6, 2016
1 parent aa79963 commit 6239f3f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions functional_tests/test_surface_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ def make_plots(surface1, surface2, points, interior_edges):

def check_intersections(s_vals, t_vals, points, intersections,
edges1, edges2, interior_edges):
# pylint: disable=too-many-locals
assert len(t_vals) == len(s_vals)
assert len(points) == len(s_vals)
assert len(intersections) == len(s_vals)
Expand All @@ -477,8 +478,10 @@ def check_intersections(s_vals, t_vals, points, intersections,
point_on2 = edge2.evaluate(t_val)
CONFIG.assert_close(point_on2[0], point[0])
CONFIG.assert_close(point_on2[1], point[1])
# pylint: enable=too-many-locals


# pylint: disable=too-many-arguments
def surface_surface_check(surface1, surface2, s_vals, t_vals, points,
edge_inds1, edge_inds2, interior_edges):
assert surface1.is_valid
Expand All @@ -496,9 +499,11 @@ def surface_surface_check(surface1, surface2, s_vals, t_vals, points,
expected1, expected2, interior_edges)

make_plots(surface1, surface2, points, interior_edges)
# pylint: enable=too-many-arguments


def test_surfaces1Q_and_3Q():
# pylint: disable=too-many-locals
# NOTE: There are only truly 4 intersections, but two of
# them occur at corners of the surface, so they both
# get quadruple counted, taking the total to 4(2) + 2 = 10.
Expand Down Expand Up @@ -542,6 +547,7 @@ def test_surfaces1Q_and_3Q():

assert exc_info.value.args == ENDPOINT_FAILURE
make_plots(SURFACE1Q, SURFACE3Q, points, interior_edges)
# pylint: enable=too-many-locals


def test_surfaces1L_and_3L():
Expand Down Expand Up @@ -720,6 +726,7 @@ def test_surfaces1Q_and_5L():


def test_surfaces3Q_and_5Q():
# pylint: disable=too-many-locals
s_val3, _ = runtime_utils.real_roots([25, -130, 167, -302, 57])
s_val4, _ = runtime_utils.real_roots([25, -130, 901, -1212, 279])
edge_s_vals = np.array([0.25, 0.25, s_val3, s_val4])
Expand Down Expand Up @@ -749,6 +756,7 @@ def test_surfaces3Q_and_5Q():

assert exc_info.value.args == ENDPOINT_FAILURE
make_plots(SURFACE3Q, SURFACE5Q, points, interior_edges)
# pylint: enable=too-many-locals


def test_surfaces1L_and_2L():
Expand Down
18 changes: 9 additions & 9 deletions tests/test_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,31 +956,31 @@ def test_locate_bad_point(self):
surface.locate(point2)

def test_intersect(self):
surface1 = self._make_one(self.UNIT_TRIANGLE)
nodes1 = self.UNIT_TRIANGLE
surface1 = self._make_one(nodes1)
# Similar triangle with overlapping square.
surface2 = self._make_one(np.array([
nodes2 = np.array([
[0.25, 0.25],
[-0.75, 0.25],
[0.25, -0.75],
]))
])
surface2 = self._make_one(nodes2)

intersections = surface1.intersect(surface2)
self.assertEqual(len(intersections), 2)

int0 = intersections[0]
self.assertEqual(int0.s, 0.25)
self.assertEqual(int0.t, 0.75)
self.assertTrue(np.all(int0.left._nodes == surface1._nodes[:2, :]))
self.assertTrue(np.all(
int0.right._nodes == surface2._nodes[(2, 0), :]))
self.assertTrue(np.all(int0.left._nodes == nodes1[:2, :]))
self.assertTrue(np.all(int0.right._nodes == nodes2[(2, 0), :]))
self.assertEqual(int0.interior_curve, 1)

int1 = intersections[1]
self.assertEqual(int0.s, 0.25)
self.assertEqual(int0.t, 0.75)
self.assertTrue(np.all(
int1.left._nodes == surface1._nodes[(2, 0), :]))
self.assertTrue(np.all(int1.right._nodes == surface2._nodes[:2, :]))
self.assertTrue(np.all(int1.left._nodes == nodes1[(2, 0), :]))
self.assertTrue(np.all(int1.right._nodes == nodes2[:2, :]))
self.assertEqual(int1.interior_curve, 0)

def test_intersect_non_surface(self):
Expand Down

0 comments on commit 6239f3f

Please sign in to comment.