Skip to content

Commit 8800b6b

Browse files
committed
add a simple unit test
1 parent 790f257 commit 8800b6b

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/unit/test_json.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
import datetime as dt
17+
from typing import Optional
18+
19+
import pandas
20+
import pandas.api.extensions
21+
import pandas.testing
22+
import pyarrow
23+
import pytest
24+
25+
import packaging.version
26+
27+
import db_dtypes
28+
29+
is_supported_version = packaging.version.Version(pandas.__version__) >= packaging.version.Version("1.5.0")
30+
31+
@pytest.mark.skipif(not is_supported_version, reason="requires Pandas 1.5.0 and above")
32+
def test_constructor_from_sequence():
33+
json_obj = [0, "str", {"a": 0, "b": 1}]
34+
data = db_dtypes.JSONArray._from_sequence(json_obj)

0 commit comments

Comments
 (0)