Skip to content

Commit 5f625b2

Browse files
one more test and general simplication
1 parent d86dd07 commit 5f625b2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

tests/test_bffd.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ def test_nothing_happens(self):
1414
A = np.random.rand(3, original_mesh_points.reshape(-1).shape[0])
1515
b = cffd.fun(original_mesh_points)
1616
cffd.fixval = b
17-
cffd.indices = np.arange(np.prod(cffd.n_control_points) * 3).tolist()
18-
cffd.M = np.eye(len(cffd.indices))
1917
new_mesh_points = cffd(original_mesh_points)
2018
assert np.array_equal(original_mesh_points, new_mesh_points)
2119

@@ -28,8 +26,6 @@ def test_constraint(self):
2826
"tests/test_datasets/meshpoints_sphere_orig.npy")
2927
b = cffd.fun(original_mesh_points)
3028
cffd.fixval = b
31-
cffd.indices = np.arange(np.prod(cffd.n_control_points) * 3).tolist()
32-
cffd.M = np.eye(len(cffd.indices))
3329
new_mesh_points = cffd(original_mesh_points)
3430
assert np.isclose(np.linalg.norm(cffd.fun(new_mesh_points) - b),
3531
np.array([0.0]))

tests/test_cffd.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66

77

88
class TestCFFD(TestCase):
9+
def test_nothing_happens_0(self):
10+
np.random.seed(0)
11+
cffd = CFFD()
12+
original_mesh_points = np.load(
13+
"tests/test_datasets/meshpoints_sphere_orig.npy")
14+
A = np.random.rand(3, original_mesh_points.reshape(-1).shape[0])
15+
16+
def fun(x):
17+
x = x.reshape(-1)
18+
return A @ x
19+
new_mesh_points = cffd(original_mesh_points)
20+
assert np.array_equal(original_mesh_points, new_mesh_points)
21+
22+
923
def test_nothing_happens(self):
1024
np.random.seed(0)
1125
cffd = CFFD()

0 commit comments

Comments
 (0)