Skip to content

Commit 0de9b5b

Browse files
committed
tests updated
1 parent fa7bfeb commit 0de9b5b

5 files changed

Lines changed: 321 additions & 680 deletions

File tree

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
from __future__ import annotations
22

3-
import pytest
3+
import random
44

55
from deepeval.optimizer.algorithms import COPRO
66

77

8-
def test_copro_defaults():
8+
def test_copro_defaults() -> None:
99
algo = COPRO()
10+
assert algo.depth == 4
11+
assert algo.breadth == 7
12+
assert algo.minibatch_size == 25
13+
assert isinstance(algo.random_state, random.Random)
14+
assert isinstance(algo.seed, int)
1015

11-
# Base defaults
12-
assert algo.iterations == 5
13-
assert algo.minibatch_size == 8
14-
assert algo.exploration_probability == 0.2
15-
assert algo.full_eval_every == 5
16-
assert isinstance(algo.random_seed, int)
1716

18-
# COPRO-specific defaults
19-
assert algo.population_size == 4
20-
assert algo.proposals_per_step == 4
17+
def test_copro_accepts_explicit_random_state() -> None:
18+
r = random.Random(123)
19+
algo = COPRO(random_state=r)
20+
assert algo.random_state is r
21+
assert isinstance(algo.seed, int)
2122

2223

23-
@pytest.mark.parametrize("value", [0, -1])
24-
def test_copro_rejects_non_positive_population_size(value: int):
25-
with pytest.raises(ValueError):
26-
COPRO(population_size=value)
24+
def test_copro_int_random_state_sets_seed() -> None:
25+
algo = COPRO(random_state=99)
26+
assert algo.seed == 99
27+
assert isinstance(algo.random_state, random.Random)
2728

2829

29-
@pytest.mark.parametrize("value", [0, -3])
30-
def test_copro_rejects_non_positive_proposals_per_step(value: int):
31-
with pytest.raises(ValueError):
32-
COPRO(proposals_per_step=value)
30+
def test_copro_allows_minimal_hyperparameters() -> None:
31+
algo = COPRO(depth=1, breadth=1, minibatch_size=1, random_state=0)
32+
assert algo.depth == 1
33+
assert algo.breadth == 1
34+
assert algo.minibatch_size == 1

0 commit comments

Comments
 (0)