Skip to content

Commit b844a72

Browse files
committed
fix tests
1 parent b9c5d17 commit b844a72

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

tests/pytest/test_openenv_echo_hub.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010

1111

1212
# Preferred import when using the monolithic `openenv` package
13-
from envs.echo_env import EchoEnv # type: ignore
13+
# Preferred import when using the monolithic `openenv` package
14+
try:
15+
from envs.echo_env import EchoEnv # type: ignore
16+
except ImportError:
17+
# Define dummy class to satisfy OpenEnvRolloutProcessor validation during collection
18+
class EchoEnv: # type: ignore
19+
pass
1420

1521

1622
# Skip these integration-heavy tests on CI runners by default

tests/test_human_id.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,35 @@
77
def test_generate_id_basic_format():
88
"""Test that generate_id produces the expected adjective-noun-NN format"""
99
id_str = generate_id(index=0)
10-
# Should match pattern: adjective-noun-NN where NN is 00-99
11-
assert re.match(r"^[a-z]+-[a-z]+-\d{2}$", id_str)
10+
# Should match pattern: adjective-noun-NNNNNN where NNNNNN is 000000-999999
11+
assert re.match(r"^[a-z]+-[a-z]+-\d{6}$", id_str)
1212

1313
# Test a few specific indices to ensure deterministic behavior
14-
assert generate_id(index=0) == "other-time-00"
15-
assert generate_id(index=1) == "other-time-01"
16-
assert generate_id(index=99) == "other-time-99"
17-
assert generate_id(index=100) == "other-year-00"
14+
assert generate_id(index=0) == "other-time-000000"
15+
assert generate_id(index=1) == "other-time-000001"
16+
assert generate_id(index=99) == "other-time-000099"
17+
assert generate_id(index=100) == "other-time-000100"
1818

1919

2020
def test_generate_id_index_mapping():
2121
"""Test that index mapping works correctly"""
2222
# Test number cycling (0-99)
2323
for i in range(100):
2424
id_str = generate_id(index=i)
25-
expected_num = f"{i:02d}"
25+
expected_num = f"{i:06d}"
2626
assert id_str.endswith(f"-{expected_num}")
2727
assert id_str.startswith("other-time-")
2828

29-
# Test noun advancement after 100 numbers
30-
id_100 = generate_id(index=100)
31-
assert id_100.startswith("other-year-00")
29+
# Test noun advancement after 1000000 numbers
30+
id_1000000 = generate_id(index=1000000)
31+
assert id_1000000.startswith("other-year-000000")
3232

33-
# Test adjective advancement (after all nouns * 100)
33+
# Test adjective advancement (after all nouns * 1000000)
3434
# This will depend on dictionary size, so let's test the pattern
3535
from eval_protocol.human_id import dictionary
3636

3737
nouns_count = len(dictionary.nouns)
38-
adjective_boundary = nouns_count * 100
38+
adjective_boundary = nouns_count * 1000000
3939

4040
id_at_boundary = generate_id(index=adjective_boundary)
4141
# Should have advanced to the next adjective
@@ -68,7 +68,7 @@ def test_generate_id_seed_stability():
6868
# Without index, default produces separator '-' and at least 3 components
6969
c = generate_id()
7070

71-
assert re.match(r"^[a-z]+-[a-z]+-\d{2}$", c)
71+
assert re.match(r"^[a-z]+-[a-z]+-\d{6}$", c)
7272

7373

7474
def test_generate_id_seed_with_index():
@@ -83,12 +83,12 @@ def test_generate_id_seed_with_index():
8383
assert x != y
8484

8585
# All should follow the correct format
86-
assert re.match(r"^[a-z]+-[a-z]+-\d{2}$", x)
87-
assert re.match(r"^[a-z]+-[a-z]+-\d{2}$", y)
86+
assert re.match(r"^[a-z]+-[a-z]+-\d{6}$", x)
87+
assert re.match(r"^[a-z]+-[a-z]+-\d{6}$", y)
8888

8989

9090
def test_generate_id_random_format():
9191
"""Test that random generation (no index) produces correct format"""
9292
for _ in range(10):
9393
id_str = generate_id()
94-
assert re.match(r"^[a-z]+-[a-z]+-\d{2}$", id_str)
94+
assert re.match(r"^[a-z]+-[a-z]+-\d{6}$", id_str)

0 commit comments

Comments
 (0)