Skip to content

Commit

Permalink
fix: correct broken ConversationModelEvaluation resource pattern (#509)
Browse files Browse the repository at this point in the history
* fix!: correct broken ConversationModelEvaluation resource pattern

PiperOrigin-RevId: 442646533

Source-Link: googleapis/googleapis@b62c562

Source-Link: googleapis/googleapis-gen@f5c157c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjVjMTU3YzY4MTE1ODQ3ZDc4ZWI4NDEyNzM0Y2I4MmU3ZDU1MTViNCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Apr 22, 2022
1 parent 1d63799 commit f4ff416
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,18 +217,20 @@ def parse_conversation_model_path(path: str) -> Dict[str, str]:
def conversation_model_evaluation_path(
project: str,
conversation_model: str,
evaluation: str,
) -> str:
"""Returns a fully-qualified conversation_model_evaluation string."""
return "projects/{project}/conversationModels/{conversation_model}/evaluations/evaluation".format(
return "projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}".format(
project=project,
conversation_model=conversation_model,
evaluation=evaluation,
)

@staticmethod
def parse_conversation_model_evaluation_path(path: str) -> Dict[str, str]:
"""Parses a conversation_model_evaluation path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/conversationModels/(?P<conversation_model>.+?)/evaluations/evaluation$",
r"^projects/(?P<project>.+?)/conversationModels/(?P<conversation_model>.+?)/evaluations/(?P<evaluation>.+?)$",
path,
)
return m.groupdict() if m else {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3742,20 +3742,23 @@ def test_parse_conversation_model_path():
def test_conversation_model_evaluation_path():
project = "squid"
conversation_model = "clam"
expected = "projects/{project}/conversationModels/{conversation_model}/evaluations/evaluation".format(
evaluation = "whelk"
expected = "projects/{project}/conversationModels/{conversation_model}/evaluations/{evaluation}".format(
project=project,
conversation_model=conversation_model,
evaluation=evaluation,
)
actual = ConversationModelsClient.conversation_model_evaluation_path(
project, conversation_model
project, conversation_model, evaluation
)
assert expected == actual


def test_parse_conversation_model_evaluation_path():
expected = {
"project": "whelk",
"conversation_model": "octopus",
"project": "octopus",
"conversation_model": "oyster",
"evaluation": "nudibranch",
}
path = ConversationModelsClient.conversation_model_evaluation_path(**expected)

Expand All @@ -3765,9 +3768,9 @@ def test_parse_conversation_model_evaluation_path():


def test_document_path():
project = "oyster"
knowledge_base = "nudibranch"
document = "cuttlefish"
project = "cuttlefish"
knowledge_base = "mussel"
document = "winkle"
expected = "projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}".format(
project=project,
knowledge_base=knowledge_base,
Expand All @@ -3779,9 +3782,9 @@ def test_document_path():

def test_parse_document_path():
expected = {
"project": "mussel",
"knowledge_base": "winkle",
"document": "nautilus",
"project": "nautilus",
"knowledge_base": "scallop",
"document": "abalone",
}
path = ConversationModelsClient.document_path(**expected)

Expand All @@ -3791,7 +3794,7 @@ def test_parse_document_path():


def test_common_billing_account_path():
billing_account = "scallop"
billing_account = "squid"
expected = "billingAccounts/{billing_account}".format(
billing_account=billing_account,
)
Expand All @@ -3801,7 +3804,7 @@ def test_common_billing_account_path():

def test_parse_common_billing_account_path():
expected = {
"billing_account": "abalone",
"billing_account": "clam",
}
path = ConversationModelsClient.common_billing_account_path(**expected)

Expand All @@ -3811,7 +3814,7 @@ def test_parse_common_billing_account_path():


def test_common_folder_path():
folder = "squid"
folder = "whelk"
expected = "folders/{folder}".format(
folder=folder,
)
Expand All @@ -3821,7 +3824,7 @@ def test_common_folder_path():

def test_parse_common_folder_path():
expected = {
"folder": "clam",
"folder": "octopus",
}
path = ConversationModelsClient.common_folder_path(**expected)

Expand All @@ -3831,7 +3834,7 @@ def test_parse_common_folder_path():


def test_common_organization_path():
organization = "whelk"
organization = "oyster"
expected = "organizations/{organization}".format(
organization=organization,
)
Expand All @@ -3841,7 +3844,7 @@ def test_common_organization_path():

def test_parse_common_organization_path():
expected = {
"organization": "octopus",
"organization": "nudibranch",
}
path = ConversationModelsClient.common_organization_path(**expected)

Expand All @@ -3851,7 +3854,7 @@ def test_parse_common_organization_path():


def test_common_project_path():
project = "oyster"
project = "cuttlefish"
expected = "projects/{project}".format(
project=project,
)
Expand All @@ -3861,7 +3864,7 @@ def test_common_project_path():

def test_parse_common_project_path():
expected = {
"project": "nudibranch",
"project": "mussel",
}
path = ConversationModelsClient.common_project_path(**expected)

Expand All @@ -3871,8 +3874,8 @@ def test_parse_common_project_path():


def test_common_location_path():
project = "cuttlefish"
location = "mussel"
project = "winkle"
location = "nautilus"
expected = "projects/{project}/locations/{location}".format(
project=project,
location=location,
Expand All @@ -3883,8 +3886,8 @@ def test_common_location_path():

def test_parse_common_location_path():
expected = {
"project": "winkle",
"location": "nautilus",
"project": "scallop",
"location": "abalone",
}
path = ConversationModelsClient.common_location_path(**expected)

Expand Down

0 comments on commit f4ff416

Please sign in to comment.