Skip to content

Commit c2895a1

Browse files
authored
Merge pull request #258 from ndem0/fix-tests
Fix not running test
2 parents bd13958 + 4c729e7 commit c2895a1

8 files changed

+10
-233
lines changed

tests/test_custom_deformation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import filecmp
2-
import os
31
from unittest import TestCase
42

53
import numpy as np
64
from pygem import CustomDeformation
75

86

9-
107
class TestCustomDeformation(TestCase):
118
def get_cube_mesh_points(self):
129
# Points that define a cube
@@ -23,13 +20,15 @@ def get_cube_mesh_points(self):
2320
def test_class_members_func(self):
2421
def move(x):
2522
return x + x**2
26-
deform = CustomDeformation(move)
23+
CustomDeformation(move)
2724

2825
def test_ffd_sphere_mod(self):
2926
def move(x):
3027
x0, x1, x2 = x
3128
return [x0**2, x1, x2]
3229
deform = CustomDeformation(move)
33-
mesh_points = self.get_cube_mesh_points()
30+
mesh_points = self.get_cube_mesh_points()
3431
mesh_points_test = deform(mesh_points)
32+
mesh_points_ref = mesh_points.copy()
33+
mesh_points_ref[:, 0] **= 2
3534
np.testing.assert_array_almost_equal(mesh_points_test, mesh_points_ref)

tests/test_custom_deformation_cad.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
import filecmp
2-
import os
31
from unittest import TestCase
42

53
import numpy as np
64
from pygem.cad import CustomDeformation
75
from pygem.cad import CADDeformation
86

97

10-
118
class TestCustomDeformation(TestCase):
129

1310
def test_class_members_func(self):
1411
def move(x):
1512
return x + x**2
1613
deform = CustomDeformation(move)
1714

18-
def test_ffd_sphere_mod(self):
15+
def test_customdeform_cad_type(self):
1916
def move(x):
2017
x0, x1, x2 = x
2118
return [x0**2, x1, x2]
2219
filename = 'tests/test_datasets/test_pipe_hollow.iges'
2320
orig_shape = CADDeformation.read_shape(filename)
2421
deform = CustomDeformation(move)
2522
new_shape = deform(orig_shape)
26-
assert False
27-
mesh_points = self.get_cube_mesh_points()
28-
mesh_points_test = deform(mesh_points)
29-
np.testing.assert_array_almost_equal(mesh_points_test, mesh_points_ref)
23+
assert type(new_shape) == type(orig_shape)

tests/test_ffdcad.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ def test_ffd_iges_pipe_mod_through_topods_shape(self):
4747
cre_ = np.asarray(cre[i].split(',')[:-1], dtype=float)
4848
np.testing.assert_array_almost_equal(cre_, ref_, decimal=6)
4949
self.addCleanup(os.remove, 'test_pipe_hollow_result.iges')
50-
51-
52-
50+
51+
"""
5352
def test_ffd_step_pipe_mod_through_files(self):
5453
ffd = FFD(None,30,30,30,1e-4)
5554
ffd.read_parameters(
@@ -65,3 +64,5 @@ def test_ffd_step_pipe_mod_through_files(self):
6564
cre_ = np.asarray(re.findall(r"[+-]? *(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?", cre[i]),dtype=float)
6665
np.testing.assert_array_almost_equal(cre_, ref_, decimal=6)
6766
self.addCleanup(os.remove, 'test_pipe_result.step')
67+
"""
68+
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_stlhandler.py

Lines changed: 0 additions & 217 deletions
This file was deleted.

0 commit comments

Comments
 (0)