Skip to content

Commit

Permalink
doc: migrate User Story from Robot to pytest (#359)
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Mortari <[email protected]>
  • Loading branch information
tarilabs authored Sep 11, 2024
1 parent 4eadcec commit 7506eaf
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions clients/python/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,53 @@ async def test_update_models(client: ModelRegistry):
assert client.update(ma).description == new_description


@pytest.mark.e2e
async def test_update_logical_model_with_labels(client: ModelRegistry):
"""As a MLOps engineer I would like to store some labels
A custom property of type string, with empty string value, shall be considered a Label; this is also semantically compatible for properties having empty string values in general.
"""
name = "test_model"
version = "1.0.0"
rm = client.register_model(
name,
"s3",
model_format_name="test_format",
model_format_version="test_version",
version=version,
)
assert rm.id
mv = client.get_model_version(name, version)
assert mv.id
ma = client.get_model_artifact(name, version)
assert ma.id

rm_labels = {
"my-label1": "",
"my-label2": "",
}
rm.custom_properties = rm_labels
client.update(rm)

mv_labels = {
"my-label3": "",
"my-label4": "",
}
mv.custom_properties = mv_labels
client.update(mv)

ma_labels = {
"my-label5": "",
"my-label6": "",
}
ma.custom_properties = ma_labels
client.update(ma)

assert client.get_registered_model(name).custom_properties == rm_labels
assert client.get_model_version(name, version).custom_properties == mv_labels
assert client.get_model_artifact(name, version).custom_properties == ma_labels


@pytest.mark.e2e
async def test_update_preserves_model_info(client: ModelRegistry):
name = "test_model"
Expand Down
1 change: 1 addition & 0 deletions test/robot/UserStory.robot
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ As a MLOps engineer I would like to store a longer documentation for the model
And Should Be Equal As Integers ${cnt} 2

As a MLOps engineer I would like to store some labels
# MIGRATED TO test_update_logical_model_with_labels in pytest
# A custom property of type string, with empty string value, shall be considered a Label; this is also semantically compatible for properties having empty string values in general.
${cp1} Create Dictionary my-label1=${{ {"string_value": "", "metadataType": "MetadataStringValue"} }} my-label2=${{ {"string_value": "", "metadataType": "MetadataStringValue"} }}
Set To Dictionary ${registered_model} description=Lorem ipsum dolor sit amet name=${name} customProperties=${cp1}
Expand Down

0 comments on commit 7506eaf

Please sign in to comment.