Skip to content

Commit 69bcf2c

Browse files
committed
Add assertions to new test cases
1 parent 31db9a6 commit 69bcf2c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

platypus/tests/test_core.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,26 @@ def test_problem_single_assignment():
134134
problem.directions[:] = Direction.MINIMIZE
135135
problem.constraints[:] = Constraint.LESS_THAN_ZERO
136136

137+
assert len(problem.types) == 2
138+
assert len(problem.directions) == 2
139+
assert len(problem.constraints) == 2
140+
assert all([t is not None for t in problem.types])
141+
assert all([d is not None for d in problem.directions])
142+
assert all([c is not None for c in problem.constraints])
143+
137144
def test_problem_array_assignment():
138-
problem = Problem(1, 2, 2)
145+
problem = Problem(2, 2, 2)
139146
problem.types[:] = [Real(0, 1), Real(0, 1)]
140147
problem.directions[:] = [Direction.MINIMIZE, Direction.MAXIMIZE]
141148
problem.constraints[:] = [Constraint.LESS_THAN_ZERO, Constraint.GREATER_THAN_ZERO]
142149

150+
assert len(problem.types) == 2
151+
assert len(problem.directions) == 2
152+
assert len(problem.constraints) == 2
153+
assert all([t is not None for t in problem.types])
154+
assert all([d is not None for d in problem.directions])
155+
assert all([c is not None for c in problem.constraints])
156+
143157
def test_pareto_dominance():
144158
dominance = ParetoDominance()
145159
assert -1 == dominance.compare(s0, s1)

0 commit comments

Comments
 (0)