Skip to content

Commit 73092a4

Browse files
samyarpotlapallismlindauer
authored andcommitted
Edited test_score_definitions for syntax issue
1 parent 21808ec commit 73092a4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/sasctl/_services/score_definitions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ def create_score_definition(
7575
"""
7676

7777
model = cls._model_repository.get_model(model)
78-
model_id = model.id
7978

8079
if not model:
8180
raise HTTPError(
8281
{
8382
f"This model may not exist in a project or the model may not exist at all."
8483
}
8584
)
85+
model_id = model.id
8686
model_project_id = model.get("projectId")
8787
model_project_version_id = model.get("projectVersionId")
8888
model_name = model.get("name")

tests/unit/test_score_definitions.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626

2727

2828
class CustomMock:
29-
def __init__(self, json_info):
29+
def __init__(self, json_info, id=""):
3030
self.json_info = json_info
31+
self.id = id
3132

3233
def get(self, key1, key2=None, key3=None):
3334
if key2 is None and key3 is None:
@@ -69,7 +70,7 @@ def test_create_score_definition():
6970
with pytest.raises(HTTPError):
7071
sd.create_score_definition(
7172
score_def_name="test_create_sd",
72-
model_id="12345",
73+
model="12345",
7374
table_name="test_table",
7475
)
7576

@@ -87,7 +88,7 @@ def test_create_score_definition():
8788
with pytest.raises(HTTPError):
8889
sd.create_score_definition(
8990
score_def_name="test_create_sd",
90-
model_id="12345",
91+
model="12345",
9192
table_name="test_table",
9293
)
9394

@@ -98,7 +99,7 @@ def test_create_score_definition():
9899
with pytest.raises(HTTPError):
99100
sd.create_score_definition(
100101
score_def_name="test_create_sd",
101-
model_id="12345",
102+
model="12345",
102103
table_name="test_table",
103104
table_file="test_path",
104105
)
@@ -112,7 +113,7 @@ def test_create_score_definition():
112113
get_table.return_value = get_table_mock
113114
response = sd.create_score_definition(
114115
score_def_name="test_create_sd",
115-
model_id="12345",
116+
model="12345",
116117
table_name="test_table",
117118
table_file="test_path",
118119
)
@@ -122,7 +123,7 @@ def test_create_score_definition():
122123
get_table.return_value = get_table_mock
123124
response = sd.create_score_definition(
124125
score_def_name="test_create_sd",
125-
model_id="12345",
126+
model="12345",
126127
table_name="test_table",
127128
table_file="test_path",
128129
)
@@ -146,7 +147,7 @@ def test_create_score_definition():
146147
get_table.return_value = get_table_mock
147148
response = sd.create_score_definition(
148149
score_def_name="test_create_sd",
149-
model_id="12345",
150+
model="12345",
150151
table_name="test_table",
151152
)
152153
assert response

0 commit comments

Comments
 (0)