Skip to content

Commit

Permalink
update docs from test snippet changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Sep 26, 2023
1 parent 4bcae4f commit 3b8faaa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/content/concepts/assets/software-defined-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ When writing a unit test, use <PyObject object="build_op_context" /> to mock the

```python file=/concepts/assets/asset_testing.py startafter=start_test_with_context_asset endbefore=end_test_with_context_asset
def test_uses_context():
context = build_op_context()
context = build_asset_context()
result = uses_context(context)
assert result == "bar"
```
Expand Down
4 changes: 2 additions & 2 deletions docs/content/concepts/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def test_asset_with_inputs():
If your asset has a config schema, you can pass a config value to the invocation. The following asset relies on attached config:

```python file=/concepts/ops_jobs_graphs/unit_tests.py startafter=start_test_config_asset endbefore=end_test_config_asset
from dagster import asset, Config, build_op_context
from dagster import asset, Config


class MyAssetConfig(Config):
Expand All @@ -357,7 +357,7 @@ If your asset requires resources, you can specify them as arguments when invokin
Consider the following asset, which requires a resource `foo`.

```python file=/concepts/ops_jobs_graphs/unit_tests.py startafter=start_test_resource_asset endbefore=end_test_resource_asset
from dagster import asset, ConfigurableResource, build_op_context, with_resources
from dagster import asset, ConfigurableResource


class BarResource(ConfigurableResource):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ Now we can use the stub Hacker News resource to test that the `items` asset tran


def test_items():
context = build_op_context(
context = build_asset_context(
resources={"hn_client": StubHNClient()},
op_config={"N": StubHNClient().fetch_max_item_id()},
asset_config={"N": StubHNClient().fetch_max_item_id()},
)
hn_dataset = items(context)
assert isinstance(hn_dataset, pd.DataFrame)
Expand Down

0 comments on commit 3b8faaa

Please sign in to comment.