SIENTIAPDE-1579: Fix SientiaMlException propagation in ModelServing.search_runs_by_name to correctly raise the exception with its message, resolving a TypeError. Enhance training test script to support scenario-specific CSV files for different test cases. Update search_runs_by_name return type hint and apply minor code formatting.

This commit is contained in:
Bruno Domingues
2026-02-19 21:13:41 -03:00
parent f952647cf6
commit 41c4490cad
5 changed files with 56 additions and 33 deletions

View File

@@ -993,7 +993,9 @@ class TestConfigureDatetimeIndex:
assert 'var2' in result.columns
@pytest.mark.filterwarnings('ignore::UserWarning')
def test_configure_datetime_index_invalid_timestamp_column(self, training_repo, datetime_params):
def test_configure_datetime_index_invalid_timestamp_column(
self, training_repo, datetime_params
):
"""Test _configure_datetime_index with invalid timestamp values."""
data = pd.DataFrame(
{
@@ -1199,10 +1201,12 @@ class TestEnsureDateColumnParsed:
def test_parses_column_with_format(self, date_params):
"""When date_column and date_format set, column is parsed as datetime."""
data = pd.DataFrame({
'ts': ['2023-01-01 10:00:00', '2023-06-15 14:30:00'],
'x': [1, 2],
})
data = pd.DataFrame(
{
'ts': ['2023-01-01 10:00:00', '2023-06-15 14:30:00'],
'x': [1, 2],
}
)
result = _ensure_date_column_parsed(data, date_params)
assert result['ts'].dtype == 'datetime64[ns]'
assert result['ts'].iloc[0].year == 2023
@@ -1212,10 +1216,12 @@ class TestEnsureDateColumnParsed:
def test_invalid_values_coerced_to_nat(self, date_params):
"""Invalid date strings are coerced to NaT when format is set."""
date_params.date_format = 'yyyy-MM-dd HH:mm:ss'
data = pd.DataFrame({
'ts': ['2023-01-01 00:00:00', 'not-a-date', '2023-12-31 00:00:00'],
'x': [1, 2, 3],
})
data = pd.DataFrame(
{
'ts': ['2023-01-01 00:00:00', 'not-a-date', '2023-12-31 00:00:00'],
'x': [1, 2, 3],
}
)
result = _ensure_date_column_parsed(data, date_params)
assert pd.isna(result['ts'].iloc[1])
assert result['ts'].iloc[0].year == 2023
@@ -1256,10 +1262,12 @@ class TestApplySupportFilters:
def test_snake_case_upper_lower_line(self):
"""Support filters with upper_line/lower_line (snake_case) filter rows."""
data = pd.DataFrame({
'x': [1.0, 2.0, 3.0, 4.0],
'target': [2.0, 4.0, 6.0, 8.0],
})
data = pd.DataFrame(
{
'x': [1.0, 2.0, 3.0, 4.0],
'target': [2.0, 4.0, 6.0, 8.0],
}
)
support_filters = {
'x': {
'upper_line': {'intercept': 1.0, 'angle': 50},
@@ -1272,10 +1280,12 @@ class TestApplySupportFilters:
def test_camel_case_upper_lower_line(self):
"""Support filters with upperLine/lowerLine (camelCase) are accepted."""
data = pd.DataFrame({
'x': [1.0, 2.0, 3.0],
'target': [1.0, 2.0, 3.0],
})
data = pd.DataFrame(
{
'x': [1.0, 2.0, 3.0],
'target': [1.0, 2.0, 3.0],
}
)
support_filters = {
'x': {
'upperLine': {'intercept': 2, 'angle': 5},
@@ -1288,11 +1298,13 @@ class TestApplySupportFilters:
def test_two_variables_ands_masks(self):
"""Two variables apply AND of both masks."""
data = pd.DataFrame({
'a': [1.0, 2.0, 3.0],
'b': [1.0, 2.0, 3.0],
'target': [2.0, 2.0, 2.0],
})
data = pd.DataFrame(
{
'a': [1.0, 2.0, 3.0],
'b': [1.0, 2.0, 3.0],
'target': [2.0, 2.0, 2.0],
}
)
support_filters = {
'a': {
'upper_line': {'intercept': 10, 'angle': 45},