Skip to content

Commit ecb96e8

Browse files
chelsea-lintswast
andauthored
chore: Update dev dependencies and blob metadata tests (#1576)
* test: test_blob_metadata onboards JSON Arrow extension dtype * build: add freezegun to dev packages * Update tests/unit/session/test_time.py --------- Co-authored-by: Tim Sweña (Swast) <swast@google.com>
1 parent dcd827b commit ecb96e8

File tree

4 files changed

+19
-20
lines changed

4 files changed

+19
-20
lines changed

noxfile.py

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
UNIT_TEST_STANDARD_DEPENDENCIES = [
7070
"mock",
7171
"asyncmock",
72-
"freezegun",
7372
PYTEST_VERSION,
7473
"pytest-cov",
7574
"pytest-asyncio",

setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
"pre-commit",
8484
"nox",
8585
"google-cloud-testutils",
86+
"freezegun",
8687
],
8788
}
8889
extras["all"] = list(sorted(frozenset(itertools.chain.from_iterable(extras.values()))))

tests/system/small/blob/test_properties.py

+16-18
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import db_dtypes # type: ignore
1615
import pandas as pd
1716

1817
import bigframes
18+
import bigframes.dtypes as dtypes
1919
import bigframes.pandas as bpd
2020

2121

@@ -59,26 +59,24 @@ def test_blob_metadata(images_mm_df: bpd.DataFrame):
5959
actual = images_mm_df["blob_col"].blob.metadata().to_pandas()
6060
expected = pd.Series(
6161
[
62-
{
63-
"content_type": "image/jpeg",
64-
"md5_hash": "e130ad042261a1883cd2cc06831cf748",
65-
"size": 338390,
66-
"updated": 1739574332000000,
67-
},
68-
{
69-
"content_type": "image/jpeg",
70-
"md5_hash": "e2ae3191ff2b809fd0935f01a537c650",
71-
"size": 43333,
72-
"updated": 1739574332000000,
73-
},
62+
(
63+
'{"content_type":"image/jpeg",'
64+
'"md5_hash":"e130ad042261a1883cd2cc06831cf748",'
65+
'"size":338390,'
66+
'"updated":1739574332000000}'
67+
),
68+
(
69+
'{"content_type":"image/jpeg",'
70+
'"md5_hash":"e2ae3191ff2b809fd0935f01a537c650",'
71+
'"size":43333,'
72+
'"updated":1739574332000000}'
73+
),
7474
],
7575
name="metadata",
76-
dtype=db_dtypes.JSONDtype(),
77-
)
78-
79-
pd.testing.assert_series_equal(
80-
actual, expected, check_dtype=False, check_index_type=False
76+
dtype=dtypes.JSON_DTYPE,
8177
)
78+
expected.index = expected.index.astype(dtypes.INT_DTYPE)
79+
pd.testing.assert_series_equal(actual, expected)
8280

8381

8482
def test_blob_content_type(images_mm_df: bpd.DataFrame):

tests/unit/session/test_time.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import datetime
1616
import unittest.mock as mock
1717

18-
import freezegun
1918
import google.cloud.bigquery
2019
import pytest
2120

@@ -47,6 +46,8 @@ def query_and_wait_mock(query, *args, **kwargs):
4746

4847

4948
def test_bqsyncedclock_get_time(bq_client):
49+
freezegun = pytest.importorskip("freezegun")
50+
5051
# this initial local time is actually irrelevant, only the ticks matter
5152
initial_local_datetime = datetime.datetime(
5253
year=1, month=7, day=12, hour=15, minute=6, second=3

0 commit comments

Comments
 (0)