Skip to content

Commit 4cb86ab

Browse files
committed
removed unecessary pragma tags and reimplemented checking pandas minimum statement
1 parent 570e17a commit 4cb86ab

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

tests/system/test_pandas.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,11 @@
4545
"google.cloud.bigquery_storage", minversion="2.0.0"
4646
)
4747

48-
if pandas is not None: # pragma: NO COVER
48+
if pandas is not None:
4949
PANDAS_INSTALLED_VERSION = metadata.version("pandas")
50-
else: # pragma: NO COVER
50+
else:
5151
PANDAS_INSTALLED_VERSION = "0.0.0"
5252

53-
PANDAS_INT64_VERSION = "1.0.0"
54-
5553

5654
class MissingDataError(Exception):
5755
pass
@@ -315,7 +313,7 @@ def test_load_table_from_dataframe_w_automatic_schema(bigquery_client, dataset_i
315313

316314

317315
@pytest.mark.skipif(
318-
PANDAS_INSTALLED_VERSION < PANDAS_INT64_VERSION,
316+
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
319317
reason="Only `pandas version >=1.0.0` is supported",
320318
)
321319
def test_load_table_from_dataframe_w_nullable_int64_datatype(
@@ -346,7 +344,7 @@ def test_load_table_from_dataframe_w_nullable_int64_datatype(
346344

347345

348346
@pytest.mark.skipif(
349-
PANDAS_INSTALLED_VERSION < PANDAS_INT64_VERSION,
347+
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
350348
reason="Only `pandas version >=1.0.0` is supported",
351349
)
352350
def test_load_table_from_dataframe_w_nullable_int64_datatype_automatic_schema(

tests/unit/test__pandas_helpers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363

6464
PANDAS_MINIUM_VERSION = "1.0.0"
6565

66-
if pandas is not None: # pragma: NO COVER
66+
if pandas is not None:
6767
PANDAS_INSTALLED_VERSION = metadata.version("pandas")
68-
else: # pragma: NO COVER
68+
else:
6969
PANDAS_INSTALLED_VERSION = "0.0.0"
7070

7171

@@ -808,8 +808,8 @@ def test_list_columns_and_indexes_with_named_index_same_as_column_name(
808808

809809

810810
@pytest.mark.skipif(
811-
pandas is None or PANDAS_INSTALLED_VERSION < PANDAS_MINIUM_VERSION,
812-
reason="Requires `pandas version >= 1.0.0` which introduces pandas.NA",
811+
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
812+
reason="Only `pandas version >=1.0.0` is supported",
813813
)
814814
def test_dataframe_to_json_generator(module_under_test):
815815
utcnow = datetime.datetime.utcnow()

tests/unit/test_client.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,9 @@
8080
from test_utils.imports import maybe_fail_import
8181
from tests.unit.helpers import make_connection
8282

83-
PANDAS_MINIUM_VERSION = "1.0.0"
84-
85-
if pandas is not None: # pragma: NO COVER
83+
if pandas is not None:
8684
PANDAS_INSTALLED_VERSION = metadata.version("pandas")
87-
else: # pragma: NO COVER
85+
else:
8886
PANDAS_INSTALLED_VERSION = "0.0.0"
8987

9088

@@ -8149,8 +8147,8 @@ def test_load_table_from_dataframe_unknown_table(self):
81498147
)
81508148

81518149
@unittest.skipIf(
8152-
pandas is None or PANDAS_INSTALLED_VERSION < PANDAS_MINIUM_VERSION,
8153-
"Only `pandas version >=1.0.0` supported",
8150+
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
8151+
reason="Only `pandas version >=1.0.0` is supported",
81548152
)
81558153
@unittest.skipIf(pyarrow is None, "Requires `pyarrow`")
81568154
def test_load_table_from_dataframe_w_nullable_int64_datatype(self):
@@ -8197,8 +8195,8 @@ def test_load_table_from_dataframe_w_nullable_int64_datatype(self):
81978195
)
81988196

81998197
@unittest.skipIf(
8200-
pandas is None or PANDAS_INSTALLED_VERSION < PANDAS_MINIUM_VERSION,
8201-
"Only `pandas version >=1.0.0` supported",
8198+
PANDAS_INSTALLED_VERSION[0:2] in ["0."],
8199+
reason="Only `pandas version >=1.0.0` is supported",
82028200
)
82038201
# @unittest.skipIf(pyarrow is None, "Requires `pyarrow`")
82048202
def test_load_table_from_dataframe_w_nullable_int64_datatype_automatic_schema(self):

tests/unit/test_table.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474
except (ImportError, AttributeError): # pragma: NO COVER
7575
tqdm = None
7676

77-
if pandas is not None: # pragma: NO COVER
77+
if pandas is not None:
7878
PANDAS_INSTALLED_VERSION = metadata.version("pandas")
79-
else: # pragma: NO COVER
79+
else:
8080
PANDAS_INSTALLED_VERSION = "0.0.0"
8181

8282

0 commit comments

Comments
 (0)