Skip to content

Commit 618ce38

Browse files
committed
testing
1 parent 4165e33 commit 618ce38

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

python/test/test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,25 @@ def test_with_open_version_rejects_invalid_version(self):
6868
"invalid OpEn version",
6969
):
7070
build_config.with_open_version("^1.2")
71+
72+
73+
class SmokeTests(unittest.TestCase):
7174

75+
def test_incompatible_constraints_dimensions(self):
76+
u = cs.SX.sym("u", 5)
77+
p = cs.SX.sym("p", 2)
78+
phi = og.functions.rosenbrock(u, p)
79+
bounds = og.constraints.Rectangle(xmin=[1, 2], xmax=[3, 4])
80+
problem = og.builder.Problem(u, p, phi) \
81+
.with_constraints(bounds)
82+
meta = og.config.OptimizerMeta().with_optimizer_name("abcd")
83+
build_config = og.config.BuildConfiguration() \
84+
.with_open_version(local_path=os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "rust"))) \
85+
.with_build_directory(".whatever")
86+
solver_cfg = og.config.SolverConfiguration()
87+
builder = og.builder.OpEnOptimizerBuilder(problem, meta, build_config, solver_cfg)
88+
with self.assertRaises(ValueError):
89+
builder.build()
7290

7391
class OcpSolutionTestCase(unittest.TestCase):
7492

0 commit comments

Comments
 (0)