Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit ae0536a

Browse files
committed
fix unit tests
1 parent 5b65513 commit ae0536a

3 files changed

Lines changed: 6 additions & 30 deletions

File tree

bigframes/bigquery/_operations/ai.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from bigframes import clients, dataframe, dtypes
2727
from bigframes import pandas as bpd
2828
from bigframes import series, session
29-
from bigframes.bigquery._operations import utils as ml_utils
29+
from bigframes.bigquery._operations import utils as bq_utils
3030
from bigframes.core import convert
3131
from bigframes.core.logging import log_adapter
3232
import bigframes.core.sql.literals
@@ -455,8 +455,8 @@ def generate_embedding(
455455
for details.
456456
"""
457457
data = _to_dataframe(data, series_rename="content")
458-
model_name, session = ml_utils.get_model_name_and_session(model, data)
459-
table_sql = ml_utils.to_sql(data)
458+
model_name, session = bq_utils.get_model_name_and_session(model, data)
459+
table_sql = bq_utils.to_sql(data)
460460

461461
struct_fields: Dict[str, bigframes.core.sql.literals.STRUCT_VALUES] = {}
462462
if output_dimensionality is not None:
@@ -564,8 +564,8 @@ def generate_text(
564564
The generated text.
565565
"""
566566
data = _to_dataframe(data, series_rename="prompt")
567-
model_name, session = ml_utils.get_model_name_and_session(model, data)
568-
table_sql = ml_utils.to_sql(data)
567+
model_name, session = bq_utils.get_model_name_and_session(model, data)
568+
table_sql = bq_utils.to_sql(data)
569569

570570
struct_fields: Dict[
571571
str,

bigframes/bigquery/_operations/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import bigframes
2020
from bigframes import dataframe
21+
import bigframes.ml.base
2122

2223

2324
def get_model_name_and_session(

tests/unit/bigquery/test_ml.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,6 @@ def mock_session():
4040
MODEL_NAME = "test-project.test-dataset.test-model"
4141

4242

43-
def test_get_model_name_and_session_with_pandas_series_model_input():
44-
model_name, _ = ml_ops._get_model_name_and_session(MODEL_SERIES)
45-
assert model_name == MODEL_NAME
46-
47-
48-
def test_get_model_name_and_session_with_pandas_series_model_input_missing_model_reference():
49-
model_series = pd.Series({"some_other_key": "value"})
50-
with pytest.raises(
51-
ValueError, match="modelReference must be present in the pandas Series"
52-
):
53-
ml_ops._get_model_name_and_session(model_series)
54-
55-
56-
@mock.patch("bigframes.pandas.read_pandas")
57-
def test_to_sql_with_pandas_dataframe(read_pandas_mock):
58-
df = pd.DataFrame({"col1": [1, 2, 3]})
59-
read_pandas_mock.return_value._to_sql_query.return_value = (
60-
"SELECT * FROM `pandas_df`",
61-
[],
62-
[],
63-
)
64-
ml_ops._to_sql(df)
65-
read_pandas_mock.assert_called_once()
66-
67-
6843
@mock.patch("bigframes.bigquery._operations.ml._get_model_metadata")
6944
@mock.patch("bigframes.pandas.read_pandas")
7045
def test_create_model_with_pandas_dataframe(

0 commit comments

Comments
 (0)