diff --git a/tests/unit/core/compile/sqlglot/conftest.py b/tests/unit/core/compile/sqlglot/conftest.py index 6d5fac8184..645daddd46 100644 --- a/tests/unit/core/compile/sqlglot/conftest.py +++ b/tests/unit/core/compile/sqlglot/conftest.py @@ -46,9 +46,9 @@ def _create_compiler_session(table_name, table_schema): @pytest.fixture(scope="session") -def compiler_session(scalars_types_table_schema): +def compiler_session(scalar_types_table_schema): """Compiler session for scalar types.""" - return _create_compiler_session("scalar_types", scalars_types_table_schema) + return _create_compiler_session("scalar_types", scalar_types_table_schema) @pytest.fixture(scope="session") @@ -72,7 +72,7 @@ def compiler_session_w_json_types(json_types_table_schema): @pytest.fixture(scope="session") -def scalars_types_table_schema() -> typing.Sequence[bigquery.SchemaField]: +def scalar_types_table_schema() -> typing.Sequence[bigquery.SchemaField]: return [ bigquery.SchemaField("bool_col", "BOOLEAN"), bigquery.SchemaField("bytes_col", "BYTES"), @@ -92,7 +92,7 @@ def scalars_types_table_schema() -> typing.Sequence[bigquery.SchemaField]: @pytest.fixture(scope="session") -def scalars_types_df(compiler_session) -> bpd.DataFrame: +def scalar_types_df(compiler_session) -> bpd.DataFrame: """Returns a BigFrames DataFrame containing all scalar types and using the `rowindex` column as the index.""" bf_df = compiler_session.read_gbq_table("bigframes-dev.sqlglot_test.scalar_types") @@ -101,7 +101,7 @@ def scalars_types_df(compiler_session) -> bpd.DataFrame: @pytest.fixture(scope="session") -def scalars_types_pandas_df() -> pd.DataFrame: +def scalar_types_pandas_df() -> pd.DataFrame: """Returns a pandas DataFrame containing all scalar types and using the `rowindex` column as the index.""" # TODO: add tests for empty dataframes diff --git a/tests/unit/core/compile/sqlglot/expressions/test_binary_compiler.py b/tests/unit/core/compile/sqlglot/expressions/test_binary_compiler.py index 180d43d771..f3c96e9253 100644 --- a/tests/unit/core/compile/sqlglot/expressions/test_binary_compiler.py +++ b/tests/unit/core/compile/sqlglot/expressions/test_binary_compiler.py @@ -19,24 +19,24 @@ pytest.importorskip("pytest_snapshot") -def test_add_numeric(scalars_types_df: bpd.DataFrame, snapshot): - bf_df = scalars_types_df[["int64_col"]] +def test_add_numeric(scalar_types_df: bpd.DataFrame, snapshot): + bf_df = scalar_types_df[["int64_col"]] bf_df["int64_col"] = bf_df["int64_col"] + bf_df["int64_col"] snapshot.assert_match(bf_df.sql, "out.sql") -def test_add_numeric_w_scalar(scalars_types_df: bpd.DataFrame, snapshot): - bf_df = scalars_types_df[["int64_col"]] +def test_add_numeric_w_scalar(scalar_types_df: bpd.DataFrame, snapshot): + bf_df = scalar_types_df[["int64_col"]] bf_df["int64_col"] = bf_df["int64_col"] + 1 snapshot.assert_match(bf_df.sql, "out.sql") -def test_add_string(scalars_types_df: bpd.DataFrame, snapshot): - bf_df = scalars_types_df[["string_col"]] +def test_add_string(scalar_types_df: bpd.DataFrame, snapshot): + bf_df = scalar_types_df[["string_col"]] bf_df["string_col"] = bf_df["string_col"] + "a" diff --git a/tests/unit/core/compile/sqlglot/test_compile_concat.py b/tests/unit/core/compile/sqlglot/test_compile_concat.py index ec7e83a4b0..79f73d3113 100644 --- a/tests/unit/core/compile/sqlglot/test_compile_concat.py +++ b/tests/unit/core/compile/sqlglot/test_compile_concat.py @@ -22,11 +22,11 @@ def test_compile_concat( - scalars_types_pandas_df: pd.DataFrame, compiler_session: bigframes.Session, snapshot + scalar_types_pandas_df: pd.DataFrame, compiler_session: bigframes.Session, snapshot ): # TODO: concat two same dataframes, which SQL does not get reused. # TODO: concat dataframes from a gbq table but trigger a windows compiler. - df1 = bpd.DataFrame(scalars_types_pandas_df, session=compiler_session) + df1 = bpd.DataFrame(scalar_types_pandas_df, session=compiler_session) df1 = df1[["rowindex", "int64_col", "string_col"]] concat_df = bpd.concat([df1, df1]) snapshot.assert_match(concat_df.sql, "out.sql") diff --git a/tests/unit/core/compile/sqlglot/test_compile_filter.py b/tests/unit/core/compile/sqlglot/test_compile_filter.py index 03b54f289a..0afb5eb45b 100644 --- a/tests/unit/core/compile/sqlglot/test_compile_filter.py +++ b/tests/unit/core/compile/sqlglot/test_compile_filter.py @@ -19,7 +19,7 @@ pytest.importorskip("pytest_snapshot") -def test_compile_filter(scalars_types_df: bpd.DataFrame, snapshot): - bf_df = scalars_types_df[["rowindex", "int64_col"]] +def test_compile_filter(scalar_types_df: bpd.DataFrame, snapshot): + bf_df = scalar_types_df[["rowindex", "int64_col"]] bf_filter = bf_df[bf_df["rowindex"] >= 1] snapshot.assert_match(bf_filter.sql, "out.sql") diff --git a/tests/unit/core/compile/sqlglot/test_compile_readlocal.py b/tests/unit/core/compile/sqlglot/test_compile_readlocal.py index bd27ad450e..7307fd9b4e 100644 --- a/tests/unit/core/compile/sqlglot/test_compile_readlocal.py +++ b/tests/unit/core/compile/sqlglot/test_compile_readlocal.py @@ -22,9 +22,9 @@ def test_compile_readlocal( - scalars_types_pandas_df: pd.DataFrame, compiler_session: bigframes.Session, snapshot + scalar_types_pandas_df: pd.DataFrame, compiler_session: bigframes.Session, snapshot ): - bf_df = bpd.DataFrame(scalars_types_pandas_df, session=compiler_session) + bf_df = bpd.DataFrame(scalar_types_pandas_df, session=compiler_session) snapshot.assert_match(bf_df.sql, "out.sql") diff --git a/tests/unit/core/compile/sqlglot/test_compile_readtable.py b/tests/unit/core/compile/sqlglot/test_compile_readtable.py index d3b5140471..a5692e5fbf 100644 --- a/tests/unit/core/compile/sqlglot/test_compile_readtable.py +++ b/tests/unit/core/compile/sqlglot/test_compile_readtable.py @@ -19,8 +19,8 @@ pytest.importorskip("pytest_snapshot") -def test_compile_readtable(scalars_types_df: bpd.DataFrame, snapshot): - snapshot.assert_match(scalars_types_df.sql, "out.sql") +def test_compile_readtable(scalar_types_df: bpd.DataFrame, snapshot): + snapshot.assert_match(scalar_types_df.sql, "out.sql") def test_compile_readtable_w_repeated_types(repeated_types_df: bpd.DataFrame, snapshot): @@ -37,13 +37,13 @@ def test_compile_readtable_w_json_types(json_types_df: bpd.DataFrame, snapshot): snapshot.assert_match(json_types_df.sql, "out.sql") -def test_compile_readtable_w_ordering(scalars_types_df: bpd.DataFrame, snapshot): - bf_df = scalars_types_df[["int64_col"]] +def test_compile_readtable_w_ordering(scalar_types_df: bpd.DataFrame, snapshot): + bf_df = scalar_types_df[["int64_col"]] bf_df = bf_df.sort_values("int64_col") snapshot.assert_match(bf_df.sql, "out.sql") -def test_compile_readtable_w_limit(scalars_types_df: bpd.DataFrame, snapshot): - bf_df = scalars_types_df[["int64_col"]] +def test_compile_readtable_w_limit(scalar_types_df: bpd.DataFrame, snapshot): + bf_df = scalar_types_df[["int64_col"]] bf_df = bf_df.sort_index().head(10) snapshot.assert_match(bf_df.sql, "out.sql")