Skip to content

fix(sdk): use pluralized assertions #13481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions metadata-ingestion/src/datahub/sdk/main_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

try:
from acryl_datahub_cloud._sdk_extras import ( # type: ignore[import-not-found]
AssertionClient,
AssertionsClient,
)
except ImportError:
AssertionClient = None
AssertionsClient = None


class DataHubClient:
Expand Down Expand Up @@ -112,9 +112,9 @@ def lineage(self) -> LineageClient:
return LineageClient(self)

@property
def assertion(self) -> AssertionClient: # type: ignore[return-value] # Type is not available if assertion_client is not installed
if AssertionClient is None:
def assertions(self) -> AssertionsClient: # type: ignore[return-value] # Type is not available if assertion_client is not installed
if AssertionsClient is None:
raise SdkUsageError(
"AssertionClient is not installed, please install it with `pip install acryl-datahub-cloud`"
"AssertionsClient is not installed, please install it with `pip install acryl-datahub-cloud`"
)
return AssertionClient(self)
return AssertionsClient(self)
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ def client(mock_graph: Mock) -> DataHubClient:
return DataHubClient(graph=mock_graph)


def test_use_assertion_client_fails_if_not_installed(
def test_use_assertions_client_fails_if_not_installed(
client: DataHubClient, mock_graph: Mock
) -> None:
mock_graph.exists.return_value = True

with pytest.raises(
SdkUsageError,
match="AssertionClient is not installed, please install it with `pip install acryl-datahub-cloud`",
match="AssertionsClient is not installed, please install it with `pip install acryl-datahub-cloud`",
):
client.assertion.get_assertions(urn="urn:li:assertion:123")
client.assertions.get_assertions(urn="urn:li:assertion:123")
Loading