gaurv007 commited on
Commit
4c4a751
·
verified ·
1 Parent(s): 421d033

Upload tests/test_pipeline_e2e.py

Browse files
Files changed (1) hide show
  1. tests/test_pipeline_e2e.py +11 -11
tests/test_pipeline_e2e.py CHANGED
@@ -100,7 +100,7 @@ class TestProcessCandidateDirectly:
100
  ],
101
  neutralization=Neutralization.SUBINDUSTRY,
102
  decay=5,
103
- novelty_claim="Test proven candidate",
104
  academic_anchor=None,
105
  anomaly_tag=AnomalyTag.PEAD,
106
  )
@@ -173,7 +173,7 @@ class TestLLMPathWithMocking:
173
  ],
174
  neutralization=Neutralization.SUBINDUSTRY,
175
  decay=5,
176
- novelty_claim="Mocked novel alpha",
177
  academic_anchor=None,
178
  anomaly_tag=AnomalyTag.VALUE,
179
  )
@@ -255,7 +255,7 @@ class TestLLMPathWithMocking:
255
  components=[Component(name="main", fields=[field.id], operators=["rank"], horizon_days=252, weight=1.0, sign_direction="long_high")],
256
  neutralization=Neutralization.SUBINDUSTRY,
257
  decay=5,
258
- novelty_claim="Test",
259
  academic_anchor=None,
260
  anomaly_tag=AnomalyTag.PEAD,
261
  )
@@ -263,9 +263,6 @@ class TestLLMPathWithMocking:
263
 
264
  async def _run_with_kill():
265
  # Mock crowd scout to return KILL
266
- original_scout = pipeline.__class__._process_candidate
267
- # We need to mock the internal LLM calls
268
- # Actually, let's use monkeypatch on the personas module
269
  with patch("alpha_factory.personas.crowd_scout.scout_novelty", new_callable=AsyncMock) as mock_scout:
270
  mock_scout.return_value = CrowdScoutResult(
271
  max_corr_to_library=0.9,
@@ -510,7 +507,8 @@ class TestAcceptanceChecklist:
510
  )
511
 
512
  assert not result.all_passed
513
- assert any("RETURNS-CORR" in k for k in result.blocking_failures or [])
 
514
 
515
 
516
  class TestLLMClient:
@@ -534,13 +532,15 @@ class TestLLMClient:
534
  from alpha_factory.infra.llm_client import LLMClient, LLMConfig, TokenBudgetExceeded
535
  config = LLMConfig()
536
  client = LLMClient(config)
537
- client._token_count = 4_999_999
 
538
  client._check_budget(estimated_tokens=10)
539
- assert client._token_count == 4_999_999 # Should not raise yet
540
 
541
- client._token_count = 5_000_001
 
542
  with pytest.raises(TokenBudgetExceeded):
543
- client._check_budget()
544
 
545
 
546
  class TestBrainClient:
 
100
  ],
101
  neutralization=Neutralization.SUBINDUSTRY,
102
  decay=5,
103
+ novelty_claim="Test proven candidate with sufficient length",
104
  academic_anchor=None,
105
  anomaly_tag=AnomalyTag.PEAD,
106
  )
 
173
  ],
174
  neutralization=Neutralization.SUBINDUSTRY,
175
  decay=5,
176
+ novelty_claim="Mocked novel alpha with enough chars to pass validation",
177
  academic_anchor=None,
178
  anomaly_tag=AnomalyTag.VALUE,
179
  )
 
255
  components=[Component(name="main", fields=[field.id], operators=["rank"], horizon_days=252, weight=1.0, sign_direction="long_high")],
256
  neutralization=Neutralization.SUBINDUSTRY,
257
  decay=5,
258
+ novelty_claim="Test novelty claim that is long enough",
259
  academic_anchor=None,
260
  anomaly_tag=AnomalyTag.PEAD,
261
  )
 
263
 
264
  async def _run_with_kill():
265
  # Mock crowd scout to return KILL
 
 
 
266
  with patch("alpha_factory.personas.crowd_scout.scout_novelty", new_callable=AsyncMock) as mock_scout:
267
  mock_scout.return_value = CrowdScoutResult(
268
  max_corr_to_library=0.9,
 
507
  )
508
 
509
  assert not result.all_passed
510
+ # The blocking failure message contains the threshold explanation
511
+ assert any("0.95" in f for f in result.blocking_failures or [])
512
 
513
 
514
  class TestLLMClient:
 
532
  from alpha_factory.infra.llm_client import LLMClient, LLMConfig, TokenBudgetExceeded
533
  config = LLMConfig()
534
  client = LLMClient(config)
535
+ # 4,999,000 + 10 = 4,999,010 < 5,000,000 → should NOT raise
536
+ client._token_count = 4_999_000
537
  client._check_budget(estimated_tokens=10)
538
+ assert client._token_count == 4_999_000 # Should not raise
539
 
540
+ # 4,999,999 + 10 = 5,000,009 >= 5,000,000 → SHOULD raise
541
+ client._token_count = 4_999_999
542
  with pytest.raises(TokenBudgetExceeded):
543
+ client._check_budget(estimated_tokens=10)
544
 
545
 
546
  class TestBrainClient: