repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
def test_persistent_execution():
"""Test that variables persist across multiple code executions."""
repl = LocalREPL()
# Set a variable
result1 = repl.execute_code("x = 42")
assert result1.stderr == ""
assert "x" in repl.locals
assert repl... | 42 | assert | numeric_literal | tests/repl/test_local_repl.py | test_persistent_execution | 12 | null | |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | 3 | assert | numeric_literal | tests/test_rlm_query.py | test_batched_calls_subcall_fn_per_prompt | TestRlmQueryBatchedWithSubcallFn | 92 | null |
alexzhang13/rlm | import pytest
from rlm.environments import (
RESERVED_TOOL_NAMES,
SupportsCustomTools,
extract_tool_value,
format_tools_for_prompt,
parse_custom_tools,
parse_tool_entry,
validate_custom_tools,
)
from rlm.environments.local_repl import LocalREPL
def sample_tool_function(x: int) -> int:
... | 4 | assert | numeric_literal | tests/repl/test_custom_tools.py | test_tools_with_string_context | TestCustomToolsWithContext | 235 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 10.0 | assert | numeric_literal | tests/test_depth_metadata.py | test_timeout_check_raises | TestDepth1LimitChecks | 153 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestModelUsageSummary:
def test_from_dict(self):
data = {
"total_calls": 5,
... | 100 | assert | numeric_literal | tests/test_types.py | test_from_dict | TestModelUsageSummary | 64 | null |
alexzhang13/rlm | from unittest.mock import Mock
from rlm.core.types import CodeBlock, REPLResult, RLMIteration
from rlm.environments.local_repl import LocalREPL
from rlm.utils.parsing import (
convert_context_for_repl,
find_code_blocks,
find_final_answer,
format_execution_result,
format_iteration,
)
class TestFind... | 1 | assert | numeric_literal | tests/test_parsing.py | test_single_code_block | TestFindCodeBlocks | 27 | null |
alexzhang13/rlm | from unittest.mock import MagicMock, patch
import httpx
import pytest
from rlm.clients.base_lm import DEFAULT_TIMEOUT
class TestOpenAIClientTimeout:
def test_timeout_raises_exception(self):
"""Timeout should raise appropriate exception."""
from rlm.clients.openai import OpenAIClient
# C... | httpx.TimeoutException) | pytest.raises | complex_expr | tests/clients/test_timeout.py | test_timeout_raises_exception | TestOpenAIClientTimeout | 72 | null |
alexzhang13/rlm | from unittest.mock import Mock
from rlm.core.types import CodeBlock, REPLResult, RLMIteration
from rlm.environments.local_repl import LocalREPL
from rlm.utils.parsing import (
convert_context_for_repl,
find_code_blocks,
find_final_answer,
format_execution_result,
format_iteration,
)
class TestFind... | [] | assert | collection | tests/test_parsing.py | test_no_code_blocks | TestFindCodeBlocks | 49 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_get_last_usage(self):
"""Test last usage returns co... | 100 | assert | numeric_literal | tests/clients/test_gemini.py | test_get_last_usage | TestGeminiClientUnit | 64 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | "ok 3" | assert | string_literal | tests/test_rlm_query.py | test_batched_partial_failure | TestRlmQueryBatchedWithSubcallFn | 131 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLPersistence:
def test_variable_persistence(self):
"""Test that variables persist across multiple code executions."""
repl = LocalREPL()
result1 = repl.execute_code("x = 42")
assert result1.stderr == ""... | 42 | assert | numeric_literal | tests/test_local_repl.py | test_variable_persistence | TestLocalREPLPersistence | 50 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLBuiltins:
def test_imports_work(self):
"""Test that imports work."""
repl = LocalREPL()
result = repl.execute_code("import math\nx = math.pi")
assert result.stderr == ""
assert abs(repl.locals[... | 0.001 | assert | numeric_literal | tests/test_local_repl.py | test_imports_work | TestLocalREPLBuiltins | 112 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestQueryMetadata:
def test_string_prompt(self):
meta = QueryMetadata("Hello, world!")
ass... | 13 | assert | numeric_literal | tests/test_types.py | test_string_prompt | TestQueryMetadata | 199 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | remaining_timeout | assert | variable | tests/test_subcall.py | test_all_parameters_propagate_together | TestSubcallCombinedParameters | 465 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestREPLResult:
def test_basic_creation(self):
result = REPLResult(stdout="output", stderr="", loc... | "" | assert | string_literal | tests/test_types.py | test_basic_creation | TestREPLResult | 99 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_completion_with_mocked_response(self):
"""Test comp... | 5 | assert | numeric_literal | tests/clients/test_gemini.py | test_completion_with_mocked_response | TestGeminiClientUnit | 136 | null |
alexzhang13/rlm | import pytest
from rlm.environments import (
RESERVED_TOOL_NAMES,
SupportsCustomTools,
extract_tool_value,
format_tools_for_prompt,
parse_custom_tools,
parse_tool_entry,
validate_custom_tools,
)
from rlm.environments.local_repl import LocalREPL
def sample_tool_function(x: int) -> int:
... | 2 | assert | numeric_literal | tests/repl/test_custom_tools.py | test_empty_custom_tools | TestLocalREPLCustomTools | 172 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestSerializeValue:
def test_primitives(self):
assert _serialize_value(None) is | None | assert | none_literal | tests/test_types.py | test_primitives | TestSerializeValue | 20 | null |
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
class TestLocalREPLMultiContext:
def test_add_context_auto_increment(self):
"""Test that add_context auto-increments when no index provided."""
repl = LocalREPL()
idx1 = repl.add_context("First")
idx2 = repl.add_context("Second")
... | 0 | assert | numeric_literal | tests/test_local_repl_persistent.py | test_add_context_auto_increment | TestLocalREPLMultiContext | 36 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_prepare_contents_role_mapping(self):
"""Test _prepa... | 3 | assert | numeric_literal | tests/clients/test_gemini.py | test_prepare_contents_role_mapping | TestGeminiClientUnit | 99 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | original_model | assert | variable | tests/test_subcall.py | test_model_override_does_not_mutate_parent_kwargs | TestSubcallModelOverride | 317 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | None) | assert_* | none_literal | tests/test_rlm_query.py | test_rlm_query_uses_subcall_fn | TestRlmQueryWithSubcallFn | 30 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | remaining | assert | variable | tests/test_subcall.py | test_child_receives_remaining_timeout | TestSubcallTimeoutPropagation | 74 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLSimulatingRLMNoPersistence:
def test_simulated_rlm_completions_functions_not_preserved(self):
"""
Simulates 2 RLM completions to show functions don't persist.
"""
completion_1_env = LocalREPL()
... | "useful" | assert | string_literal | tests/test_local_repl.py | test_simulated_rlm_completions_functions_not_preserved | TestLocalREPLSimulatingRLMNoPersistence | 272 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_usage_tracking_initialization(self):
"""Test that u... | {} | assert | collection | tests/clients/test_gemini.py | test_usage_tracking_initialization | TestGeminiClientUnit | 41 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestRLMChatCompletion:
def test_metadata_default_none(self):
usage = UsageSummary(model_usage_summ... | d | assert | variable | tests/test_types.py | test_metadata_default_none | TestRLMChatCompletion | 174 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | 100000 | assert | numeric_literal | tests/test_subcall.py | test_all_parameters_propagate_together | TestSubcallCombinedParameters | 460 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str]) -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mock()
mock.completion.side... | False | assert | bool_literal | tests/test_multi_turn_integration.py | test_default_is_non_persistent | TestNonPersistentMode | 280 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLHelpers:
def test_final_var_existing(self):
"""Test FINAL_VAR with existing variable."""
repl = LocalREPL()
repl.execute_code("answer = 42")
_ = repl.execute_code("result = FINAL_VAR('answer')")
... | "42" | assert | string_literal | tests/test_local_repl.py | test_final_var_existing | TestLocalREPLHelpers | 134 | null |
alexzhang13/rlm | import pytest
from rlm.environments import (
RESERVED_TOOL_NAMES,
SupportsCustomTools,
extract_tool_value,
format_tools_for_prompt,
parse_custom_tools,
parse_tool_entry,
validate_custom_tools,
)
from rlm.environments.local_repl import LocalREPL
def sample_tool_function(x: int) -> int:
... | 20 | assert | numeric_literal | tests/repl/test_custom_tools.py | test_tools_persist_across_executions | TestLocalREPLCustomTools | 156 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 0.01 | assert | numeric_literal | tests/test_depth_metadata.py | test_budget_check_raises | TestDepth1LimitChecks | 279 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | answers[1] | assert | complex_expr | tests/test_rlm_query.py | test_batched_partial_failure | TestRlmQueryBatchedWithSubcallFn | 129 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLContextManager:
def test_context_manager(self):
"""Test using LocalREPL as context manager."""
with LocalREPL() as repl:
_ = repl.execute_code("x = 100")
assert repl.locals["x"] == | 100 | assert | numeric_literal | tests/test_local_repl.py | test_context_manager | TestLocalREPLContextManager | 123 | null |
alexzhang13/rlm | import os
import pytest
from rlm import RLM
@pytest.mark.skipif(
not os.environ.get("OPENROUTER_API_KEY"),
reason="OPENROUTER_API_KEY not set",
)
def test_depth_2_real_llm():
"""Test depth=2 recursion with google/gemini-3-flash-preview."""
rlm = RLM(
backend="openrouter",
backend_kwar... | 0 | assert | numeric_literal | tests/test_e2e_depth.py | test_depth_2_real_llm | 24 | null | |
alexzhang13/rlm | from unittest.mock import MagicMock, patch
import httpx
import pytest
from rlm.clients.base_lm import DEFAULT_TIMEOUT
class TestDefaultTimeout:
def test_custom_timeout_override(self):
"""Custom timeout should override default."""
from rlm.clients.openai import OpenAIClient
with patch("r... | 60.0 | assert | numeric_literal | tests/clients/test_timeout.py | test_custom_timeout_override | TestDefaultTimeout | 34 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestRLMMetadata:
def test_to_dict(self):
meta = RLMMetadata(
root_model="gpt-4",
... | 2 | assert | numeric_literal | tests/test_types.py | test_to_dict | TestRLMMetadata | 218 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | {} | assert | collection | tests/test_depth_metadata.py | test_empty_sub_tools_propagated | TestSubcallCustomToolsPropagation | 555 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | None | assert | none_literal | tests/test_subcall.py | test_child_receives_none_timeout_when_parent_has_none | TestSubcallTimeoutPropagation | 103 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | "real" | assert | string_literal | tests/test_rlm_query.py | test_rlm_query_restored_after_overwrite | TestRlmQueryScaffoldRestoration | 199 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str]) -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mock()
mock.completion.side... | 0 | assert | numeric_literal | tests/test_multi_turn_integration.py | test_history_accumulation_across_calls | TestMultiTurnPersistentEnvironment | 111 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 100 | assert | numeric_literal | tests/test_depth_metadata.py | test_token_limit_check_raises | TestDepth1LimitChecks | 308 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_usage_tracking_initialization(self):
"""Test that u... | 0 | assert | numeric_literal | tests/clients/test_gemini.py | test_usage_tracking_initialization | TestGeminiClientUnit | 44 | null |
alexzhang13/rlm | from unittest.mock import MagicMock, patch
import httpx
import pytest
from rlm.clients.base_lm import DEFAULT_TIMEOUT
class TestDefaultTimeout:
def test_default_timeout_value(self):
"""Default timeout should be 300 seconds."""
assert DEFAULT_TIMEOUT == | 300.0 | assert | numeric_literal | tests/clients/test_timeout.py | test_default_timeout_value | TestDefaultTimeout | 16 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestModelUsageSummary:
def test_from_dict(self):
data = {
"total_calls": 5,
... | 5 | assert | numeric_literal | tests/test_types.py | test_from_dict | TestModelUsageSummary | 62 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestRLMIteration:
def test_to_dict(self):
result = REPLResult(stdout="", stderr="", locals={})
... | 1 | assert | numeric_literal | tests/test_types.py | test_to_dict | TestRLMIteration | 156 | null |
alexzhang13/rlm | import pytest
from rlm.environments import (
RESERVED_TOOL_NAMES,
SupportsCustomTools,
extract_tool_value,
format_tools_for_prompt,
parse_custom_tools,
parse_tool_entry,
validate_custom_tools,
)
from rlm.environments.local_repl import LocalREPL
def sample_tool_function(x: int) -> int:
... | 42 | assert | numeric_literal | tests/repl/test_custom_tools.py | test_callable_tool_available | TestLocalREPLCustomTools | 115 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | None | assert | none_literal | tests/test_depth_metadata.py | test_completion_returns_metadata_with_logger | TestDepth1LoggerMetadata | 329 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestSerializeValue:
def test_primitives(self):
assert _serialize_value(None) is None
asse... | True | assert | bool_literal | tests/test_types.py | test_primitives | TestSerializeValue | 21 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLPersistence:
def test_variable_persistence(self):
"""Test that variables persist across multiple code executions."""
repl = LocalREPL()
result1 = repl.execute_code("x = 42")
assert result1.stderr == ""... | 50 | assert | numeric_literal | tests/test_local_repl.py | test_variable_persistence | TestLocalREPLPersistence | 54 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 0 | assert | numeric_literal | tests/test_depth_metadata.py | test_error_count_resets_on_success | TestDepth1LimitChecks | 251 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientIntegration:
@pytest.mark.skipif(
not os.environ.get("GEMINI_API_K... | result | assert | variable | tests/clients/test_gemini.py | test_simple_completion | TestGeminiClientIntegration | 150 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestSerializeValue:
def test_primitives(self):
assert _serialize_value(None) is None
asser... | 42 | assert | numeric_literal | tests/test_types.py | test_primitives | TestSerializeValue | 22 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 1 | assert | numeric_literal | tests/test_depth_metadata.py | test_error_threshold_check | TestDepth1LimitChecks | 207 | null |
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
def test_persistent_execution():
"""Test that variables persist across multiple code executions."""
repl = LocalREPL()
# Set a variable
result1 = repl.execute_code("x = 42")
assert result1.stderr == ""
assert "x" in repl.locals
assert repl.... | 50 | assert | numeric_literal | tests/repl/test_local_repl.py | test_persistent_execution | 17 | null | |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | "ok 1" | assert | string_literal | tests/test_rlm_query.py | test_batched_partial_failure | TestRlmQueryBatchedWithSubcallFn | 128 | null |
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
def test_persistent_execution():
"""Test that variables persist across multiple code executions."""
repl = LocalREPL()
# Set a variable
result1 = repl.execute_code("x = 42")
assert result1.stderr == ""
assert "x" in | repl.locals | assert | complex_expr | tests/repl/test_local_repl.py | test_persistent_execution | 11 | null | |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLBuiltins:
def test_safe_builtins_available(self):
"""Test that safe builtins are available."""
repl = LocalREPL()
# Test various safe builtins
_ = repl.execute_code("x = len([1, 2, 3])")
assert... | [1, 2, 3] | assert | collection | tests/test_local_repl.py | test_safe_builtins_available | TestLocalREPLBuiltins | 103 | null |
alexzhang13/rlm | from unittest.mock import MagicMock, patch
import httpx
import pytest
from rlm.clients.base_lm import DEFAULT_TIMEOUT
class TestLiteLLMClientTimeout:
def test_timeout_passed_to_completion(self):
"""Timeout should be passed to litellm.completion call."""
pytest.importorskip("litellm")
fro... | 120.0 | assert | numeric_literal | tests/clients/test_timeout.py | test_timeout_passed_to_completion | TestLiteLLMClientTimeout | 166 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | "42" | assert | string_literal | tests/test_depth_metadata.py | test_basic_completion_with_final_answer | TestDepth1CompletionLoop | 59 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str]) -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mock()
mock.completion.side... | env.locals | assert | complex_expr | tests/test_multi_turn_integration.py | test_history_accumulation_across_calls | TestMultiTurnPersistentEnvironment | 107 | null |
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
class TestLocalREPLPersistentState:
def test_full_persistent_session_simulation(self):
"""Simulate a multi-turn persistent session."""
repl = LocalREPL()
repl.add_context("Document: Sales were $1000")
repl.execute_code("sales = 100... | 600 | assert | numeric_literal | tests/test_local_repl_persistent.py | test_full_persistent_session_simulation | TestLocalREPLPersistentState | 199 | null |
alexzhang13/rlm | from unittest.mock import MagicMock, patch
import httpx
import pytest
from rlm.clients.base_lm import DEFAULT_TIMEOUT
class TestDefaultTimeout:
def test_base_lm_stores_timeout(self):
"""BaseLM should store timeout in instance."""
from rlm.clients.openai import OpenAIClient
with patch("r... | DEFAULT_TIMEOUT | assert | variable | tests/clients/test_timeout.py | test_base_lm_stores_timeout | TestDefaultTimeout | 25 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | 1 | assert | numeric_literal | tests/test_rlm_query.py | test_rlm_query_tracks_pending_calls | TestRlmQueryWithSubcallFn | 48 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 2 | assert | numeric_literal | tests/test_depth_metadata.py | test_error_threshold_check | TestDepth1LimitChecks | 212 | null |
alexzhang13/rlm | from unittest.mock import MagicMock
from rlm.core.types import RLMChatCompletion, UsageSummary
from rlm.environments.local_repl import LocalREPL
def _make_completion(response: str) -> RLMChatCompletion:
"""Create a minimal RLMChatCompletion for testing."""
return RLMChatCompletion(
root_model="test-mo... | ["real"] | assert | collection | tests/test_rlm_query.py | test_rlm_query_batched_restored_after_overwrite | TestRlmQueryScaffoldRestoration | 209 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | 10 | assert | numeric_literal | tests/test_subcall.py | test_all_parameters_propagate_together | TestSubcallCombinedParameters | 461 | null |
alexzhang13/rlm | import pytest
from rlm.environments import (
RESERVED_TOOL_NAMES,
SupportsCustomTools,
extract_tool_value,
format_tools_for_prompt,
parse_custom_tools,
parse_tool_entry,
validate_custom_tools,
)
from rlm.environments.local_repl import LocalREPL
def sample_tool_function(x: int) -> int:
... | 50 | assert | numeric_literal | tests/repl/test_custom_tools.py | test_tool_with_closure | TestCustomToolsEdgeCases | 268 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLBasic:
def test_simple_execution(self):
"""Test basic code execution."""
repl = LocalREPL()
result = repl.execute_code("x = 1 + 2")
assert result.stderr == | "" | assert | string_literal | tests/test_local_repl.py | test_simple_execution | TestLocalREPLBasic | 15 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | "test-key" | assert | string_literal | tests/test_subcall.py | test_model_override_sets_child_backend_kwargs | TestSubcallModelOverride | 286 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str]) -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mock()
mock.completion.side... | 84 | assert | numeric_literal | tests/test_multi_turn_integration.py | test_variable_persistence_across_completions | TestMultiTurnPersistentEnvironment | 135 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | "parent-model" | assert | string_literal | tests/test_subcall.py | test_no_model_override_uses_parent_kwargs | TestSubcallModelOverride | 348 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | 5 | assert | numeric_literal | tests/test_subcall.py | test_child_receives_max_errors | TestSubcallErrorsPropagation | 220 | null |
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
class TestLocalREPLMultiContext:
def test_add_context_auto_increment(self):
"""Test that add_context auto-increments when no index provided."""
repl = LocalREPL()
idx1 = repl.add_context("First")
idx2 = repl.add_context("Second")
... | 1 | assert | numeric_literal | tests/test_local_repl_persistent.py | test_add_context_auto_increment | TestLocalREPLMultiContext | 37 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | "leaf response" | assert | string_literal | tests/test_subcall.py | test_model_override_at_leaf_depth_uses_overridden_model | TestSubcallModelOverrideAtLeafDepth | 392 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLBuiltins:
def test_safe_builtins_available(self):
"""Test that safe builtins are available."""
repl = LocalREPL()
# Test various safe builtins
_ = repl.execute_code("x = len([1, 2, 3])")
assert... | 10 | assert | numeric_literal | tests/test_local_repl.py | test_safe_builtins_available | TestLocalREPLBuiltins | 100 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestModelUsageSummary:
def test_to_dict(self):
summary = ModelUsageSummary(
total_call... | 500 | assert | numeric_literal | tests/test_types.py | test_to_dict | TestModelUsageSummary | 53 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 160 | assert | numeric_literal | tests/test_depth_metadata.py | test_token_limit_check_raises | TestDepth1LimitChecks | 307 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | result.response | assert | complex_expr | tests/test_subcall.py | test_subcall_returns_error_when_timeout_exhausted | TestSubcallTimeoutPropagation | 125 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str]) -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mock()
mock.completion.side... | 3 | assert | numeric_literal | tests/test_multi_turn_integration.py | test_context_accumulation_across_calls | TestMultiTurnPersistentEnvironment | 80 | null |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientIntegration:
@pytest.mark.skipif(
not os.environ.get("GEMINI_API_K... | 1 | assert | numeric_literal | tests/clients/test_gemini.py | test_simple_completion | TestGeminiClientIntegration | 155 | null |
alexzhang13/rlm | from unittest.mock import Mock, patch
import pytest
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
from rlm.logger import RLMLogger
from rlm.utils.exceptions import (
BudgetExceededError,
ErrorThresholdExceededError,
TimeoutExceededError,
... | 3 | assert | numeric_literal | tests/test_depth_metadata.py | test_metadata_has_multiple_iterations | TestDepth1LoggerMetadata | 371 | null |
alexzhang13/rlm | from rlm.environments.local_repl import LocalREPL
def test_persistent_execution():
"""Test that variables persist across multiple code executions."""
repl = LocalREPL()
# Set a variable
result1 = repl.execute_code("x = 42")
assert result1.stderr == | "" | assert | string_literal | tests/repl/test_local_repl.py | test_persistent_execution | 10 | null | |
alexzhang13/rlm | import os
from unittest.mock import MagicMock, patch
import pytest
from dotenv import load_dotenv
from rlm.clients.gemini import GeminiClient
from rlm.core.types import ModelUsageSummary, UsageSummary
load_dotenv()
class TestGeminiClientUnit:
def test_completion_with_mocked_response(self):
"""Test comp... | 10 | assert | numeric_literal | tests/clients/test_gemini.py | test_completion_with_mocked_response | TestGeminiClientUnit | 135 | null |
alexzhang13/rlm | from rlm.core.types import (
CodeBlock,
ModelUsageSummary,
QueryMetadata,
REPLResult,
RLMChatCompletion,
RLMIteration,
RLMMetadata,
UsageSummary,
_serialize_value,
)
class TestModelUsageSummary:
def test_to_dict(self):
summary = ModelUsageSummary(
total_call... | 10 | assert | numeric_literal | tests/test_types.py | test_to_dict | TestModelUsageSummary | 51 | null |
alexzhang13/rlm | import pytest
from rlm.environments import (
RESERVED_TOOL_NAMES,
SupportsCustomTools,
extract_tool_value,
format_tools_for_prompt,
parse_custom_tools,
parse_tool_entry,
validate_custom_tools,
)
from rlm.environments.local_repl import LocalREPL
def sample_tool_function(x: int) -> int:
... | "" | assert | string_literal | tests/repl/test_custom_tools.py | test_callable_tool_available | TestLocalREPLCustomTools | 114 | null |
alexzhang13/rlm | import os
from rlm.environments.local_repl import LocalREPL
class TestLocalREPLBasic:
def test_simple_execution(self):
"""Test basic code execution."""
repl = LocalREPL()
result = repl.execute_code("x = 1 + 2")
assert result.stderr == ""
assert repl.locals["x"] == | 3 | assert | numeric_literal | tests/test_local_repl.py | test_simple_execution | TestLocalREPLBasic | 16 | null |
alexzhang13/rlm | import importlib
import sys
from collections import defaultdict
import pytest
class TestTopLevelImports:
def test_rlm_rlm_import(self):
"""Test that RLM class can be imported from rlm."""
from rlm import RLM
assert RLM is not | None | assert | none_literal | tests/test_imports.py | test_rlm_rlm_import | TestTopLevelImports | 24 | null |
alexzhang13/rlm | import time
from unittest.mock import Mock, patch
import rlm.core.rlm as rlm_module
from rlm import RLM
from rlm.core.types import ModelUsageSummary, UsageSummary
def create_mock_lm(responses: list[str], model_name: str = "mock-model") -> Mock:
"""Create a mock LM that returns responses in order."""
mock = Mo... | "override-model" | assert | string_literal | tests/test_subcall.py | test_model_override_sets_child_backend_kwargs | TestSubcallModelOverride | 284 | null |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_postgres_complex_db_name_parsing():
"""Make sure we can use complex postgres host."""
env_url = (
'postgres://user:password@//cloudsql/'
'project-1234:us-central1:instance/dbnam... | 'user' | assert | string_literal | tests/test_db.py | test_postgres_complex_db_name_parsing | 260 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_required_path():
root = Path('/home')
with pytest.raises( | ImproperlyConfigured) | pytest.raises | variable | tests/test_path.py | test_required_path | 102 | null | |
joke2k/django-environ | from environ import Env
import pytest
from django.core.exceptions import ImproperlyConfigured
def test_channels_parsing():
url = "inmemory://"
result = Env.channels_url_config(url)
assert result["BACKEND"] == "channels.layers.InMemoryChannelLayer"
url = "redis://user:password@localhost:6379/0"
res... | "redis://user:password@localhost:6379/0" | assert | string_literal | tests/test_channels.py | test_channels_parsing | 23 | null | |
joke2k/django-environ | import os
import tempfile
from contextlib import contextmanager
import pytest
import environ
def make_temp_file(text):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write(text)
f.close()
try:
yield f.name
finally:
if os.path.exists(f.name):
os.unl... | KeyError) | pytest.raises | variable | tests/test_fileaware.py | test_del_key | TestDelItem | 123 | null |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
@pytest.mark.parametrize(
'url,engine,name,host,user,passwd,port',
[
# postgres://user:password@host:port/dbname
('postgres://enigma:secret@example.com:5431/dbname',
DJANGO_POST... | name | assert | variable | tests/test_db.py | test_db_parsing | 223 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
@pytest.mark.parametrize(
'url,engine,name,host,user,passwd,port',
[
# postgres://user:password@host:port/dbname
('postgres://enigma:secret@example.com:5431/dbname',
DJANGO_POST... | host | assert | variable | tests/test_db.py | test_db_parsing | 229 | null | |
joke2k/django-environ | import pytest
from environ import Env
def test_custom_search_engine():
"""Override ENGINE determined from schema."""
env_url = 'elasticsearch://127.0.0.1:9200/index'
engine = 'mypackage.backends.whatever'
url = Env.db_url_config(env_url, engine=engine)
assert url['ENGINE'] == | engine | assert | variable | tests/test_search.py | test_custom_search_engine | 97 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | '' | assert | string_literal | tests/test_env.py | test_url_empty_string_default_value | TestEnv | 336 | null |
joke2k/django-environ | from environ import Env
import pytest
from django.core.exceptions import ImproperlyConfigured
def test_channels_invalid_schema():
with pytest.raises(ImproperlyConfigured) as exc:
Env.channels_url_config("unsupported://")
assert 'Invalid channels schema unsupported' == | str(exc.value) | assert | func_call | tests/test_channels.py | test_channels_invalid_schema | 48 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
def test_base_options_parsing_memcache():
url = ('memcache://127.0.0.1:11211/?timeout... | 0 | assert | numeric_literal | tests/test_cache.py | test_base_options_parsing_memcache | 31 | null | |
joke2k/django-environ | import os
import tempfile
from contextlib import contextmanager
import pytest
import environ
def make_temp_file(text):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write(text)
f.close()
try:
yield f.name
finally:
if os.path.exists(f.name):
os.unl... | 4 | assert | numeric_literal | tests/test_fileaware.py | test_len | 79 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | [] | assert | collection | tests/test_env.py | test_not_present_with_default_warning_disabled | TestEnv | 131 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.