Skip to content

Commit 177dbda

Browse files
committed
make name first argument passed to scenario builder
1 parent 70c5e5f commit 177dbda

6 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/runloop_api_client/sdk/async_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def builder(self, name: str) -> AsyncScenarioBuilder:
801801
:return: A new AsyncScenarioBuilder instance
802802
:rtype: AsyncScenarioBuilder
803803
"""
804-
return AsyncScenarioBuilder(self._client, name)
804+
return AsyncScenarioBuilder(name, self._client)
805805

806806
def from_id(self, scenario_id: str) -> AsyncScenario:
807807
"""Get an AsyncScenario instance for an existing scenario ID.

src/runloop_api_client/sdk/async_scenario_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ class AsyncScenarioBuilder:
4141
>>> scenario = await builder.push()
4242
"""
4343

44-
def __init__(self, client: AsyncRunloop, name: str) -> None:
44+
def __init__(self, name: str, client: AsyncRunloop) -> None:
4545
"""Initialize the builder.
4646
47-
:param client: AsyncRunloop client instance
48-
:type client: AsyncRunloop
4947
:param name: Name for the scenario
5048
:type name: str
49+
:param client: AsyncRunloop client instance
50+
:type client: AsyncRunloop
5151
"""
5252
self._client = client
5353
self._name = name

src/runloop_api_client/sdk/scenario_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ class ScenarioBuilder:
4141
>>> scenario = builder.push()
4242
"""
4343

44-
def __init__(self, client: Runloop, name: str) -> None:
44+
def __init__(self, name: str, client: Runloop) -> None:
4545
"""Initialize the builder.
4646
47-
:param client: Runloop client instance
48-
:type client: Runloop
4947
:param name: Name for the scenario
5048
:type name: str
49+
:param client: Runloop client instance
50+
:type client: Runloop
5151
"""
5252
self._client = client
5353
self._name = name

src/runloop_api_client/sdk/sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def builder(self, name: str) -> ScenarioBuilder:
822822
:return: A new ScenarioBuilder instance
823823
:rtype: ScenarioBuilder
824824
"""
825-
return ScenarioBuilder(self._client, name)
825+
return ScenarioBuilder(name, self._client)
826826

827827
def from_id(self, scenario_id: str) -> Scenario:
828828
"""Get a Scenario instance for an existing scenario ID.

tests/sdk/test_async_scenario_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def mock_snapshot(self, mock_async_client: MagicMock) -> AsyncSnapshot:
3636
@pytest.fixture
3737
def builder(self, mock_async_client: MagicMock) -> AsyncScenarioBuilder:
3838
"""Create an AsyncScenarioBuilder instance with mock client."""
39-
return AsyncScenarioBuilder(mock_async_client, "test-scenario")
39+
return AsyncScenarioBuilder("test-scenario", mock_async_client)
4040

4141
def test_instantiation(self, mock_async_client: MagicMock) -> None:
4242
"""Test builder initialization and repr."""
43-
builder = AsyncScenarioBuilder(mock_async_client, "my-scenario")
43+
builder = AsyncScenarioBuilder("my-scenario", mock_async_client)
4444

4545
assert builder._client is mock_async_client
4646
assert builder._name == "my-scenario"
@@ -136,7 +136,7 @@ def test_build_params_validation(self, builder: AsyncScenarioBuilder) -> None:
136136
builder._build_params()
137137

138138
# Missing scorer (new builder)
139-
builder2 = AsyncScenarioBuilder(builder._client, "test2")
139+
builder2 = AsyncScenarioBuilder("test2", builder._client)
140140
builder2.with_problem_statement("Fix the bug")
141141
with pytest.raises(ValueError, match="At least one scorer is required"):
142142
builder2._build_params()

tests/sdk/test_scenario_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ def mock_snapshot(self, mock_client: MagicMock) -> Snapshot:
3434
@pytest.fixture
3535
def builder(self, mock_client: MagicMock) -> ScenarioBuilder:
3636
"""Create a ScenarioBuilder instance with mock client."""
37-
return ScenarioBuilder(mock_client, "test-scenario")
37+
return ScenarioBuilder("test-scenario", mock_client)
3838

3939
def test_instantiation(self, mock_client: MagicMock) -> None:
4040
"""Test builder initialization and repr."""
41-
builder = ScenarioBuilder(mock_client, "my-scenario")
41+
builder = ScenarioBuilder("my-scenario", mock_client)
4242

4343
assert builder._client is mock_client
4444
assert builder._name == "my-scenario"
@@ -134,7 +134,7 @@ def test_build_params_validation(self, builder: ScenarioBuilder) -> None:
134134
builder._build_params()
135135

136136
# Missing scorer (new builder)
137-
builder2 = ScenarioBuilder(builder._client, "test2")
137+
builder2 = ScenarioBuilder("test2", builder._client)
138138
builder2.with_problem_statement("Fix the bug")
139139
with pytest.raises(ValueError, match="At least one scorer is required"):
140140
builder2._build_params()

0 commit comments

Comments
 (0)