Skip to content

Commit

Permalink
remove unnecessary version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kiraksi committed Nov 27, 2023
1 parent 893704a commit 9331a7e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 36 deletions.
8 changes: 0 additions & 8 deletions tests/system/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,6 @@ def test_load_table_from_dataframe_w_automatic_schema(bigquery_client, dataset_i
]


@pytest.mark.skipif(
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
reason="Only `pandas version >=1.0.0` is supported",
)
def test_load_table_from_dataframe_w_nullable_int64_datatype(
bigquery_client, dataset_id
):
Expand Down Expand Up @@ -343,10 +339,6 @@ def test_load_table_from_dataframe_w_nullable_int64_datatype(
assert table.num_rows == 4


@pytest.mark.skipif(
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
reason="Only `pandas version >=1.0.0` is supported",
)
def test_load_table_from_dataframe_w_nullable_int64_datatype_automatic_schema(
bigquery_client, dataset_id, table_id
):
Expand Down
17 changes: 2 additions & 15 deletions tests/unit/test__pandas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@

bigquery_storage = _versions_helpers.BQ_STORAGE_VERSIONS.try_import()

PANDAS_MINIUM_VERSION = "1.0.0"

if pandas is not None:
PANDAS_INSTALLED_VERSION = metadata.version("pandas")
else:
Expand Down Expand Up @@ -807,10 +805,7 @@ def test_list_columns_and_indexes_with_named_index_same_as_column_name(
assert columns_and_indexes == expected


@pytest.mark.skipif(
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
reason="Only `pandas version >=1.0.0` is supported",
)
@pytest.mark.skipif(pandas is None, reason="Requires `pandas`")
def test_dataframe_to_json_generator(module_under_test):
utcnow = datetime.datetime.utcnow()
df_data = collections.OrderedDict(
Expand Down Expand Up @@ -838,16 +833,8 @@ def test_dataframe_to_json_generator(module_under_test):
assert list(rows) == expected


@pytest.mark.skipif(pandas is None, reason="Requires `pandas`")
def test_dataframe_to_json_generator_repeated_field(module_under_test):
pytest.importorskip(
"pandas",
minversion=str(PANDAS_MINIUM_VERSION),
reason=(
f"Requires `pandas version >= {PANDAS_MINIUM_VERSION}` "
"which introduces pandas.NA"
),
)

df_data = [
collections.OrderedDict(
[("repeated_col", [pandas.NA, 2, None, 4]), ("not_repeated_col", "first")]
Expand Down
15 changes: 2 additions & 13 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@
from test_utils.imports import maybe_fail_import
from tests.unit.helpers import make_connection

if pandas is not None:
PANDAS_INSTALLED_VERSION = metadata.version("pandas")
else:
PANDAS_INSTALLED_VERSION = "0.0.0"


def _make_credentials():
import google.auth.credentials
Expand Down Expand Up @@ -8146,11 +8141,8 @@ def test_load_table_from_dataframe_unknown_table(self):
timeout=DEFAULT_TIMEOUT,
)

@unittest.skipIf(
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
reason="Only `pandas version >=1.0.0` is supported",
)
@unittest.skipIf(pyarrow is None, "Requires `pyarrow`")
@unittest.skipIf(pandas is None, "Requires `pandas`")
def test_load_table_from_dataframe_w_nullable_int64_datatype(self):
from google.cloud.bigquery.client import _DEFAULT_NUM_RETRIES
from google.cloud.bigquery import job
Expand Down Expand Up @@ -8194,11 +8186,8 @@ def test_load_table_from_dataframe_w_nullable_int64_datatype(self):
SchemaField("x", "INT64", "NULLABLE", None),
)

@unittest.skipIf(
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
reason="Only `pandas version >=1.0.0` is supported",
)
# @unittest.skipIf(pyarrow is None, "Requires `pyarrow`")
@unittest.skipIf(pandas is None, "Requires `pandas`")
def test_load_table_from_dataframe_w_nullable_int64_datatype_automatic_schema(self):
from google.cloud.bigquery.client import _DEFAULT_NUM_RETRIES
from google.cloud.bigquery import job
Expand Down

0 comments on commit 9331a7e

Please sign in to comment.