Skip to content

Commit 06b8bba

Browse files
committed
test(bigframes): compare JSON strings as dicts in tests
1 parent c109f00 commit 06b8bba

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/bigframes/tests/system/small/bigquery/test_json.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import json
1516
import geopandas as gpd # type: ignore
1617
import pandas as pd
1718
import pyarrow as pa
@@ -408,7 +409,9 @@ def test_to_json_from_struct():
408409
dtype=dtypes.JSON_DTYPE,
409410
)
410411

411-
pd.testing.assert_series_equal(actual.to_pandas(), expected.to_pandas())
412+
actual_json = [json.loads(x) for x in actual.to_pandas()]
413+
expected_json = [json.loads(x) for x in expected.to_pandas()]
414+
assert actual_json == expected_json
412415

413416

414417
def test_to_json_string_from_int():
@@ -428,13 +431,14 @@ def test_to_json_string_from_struct():
428431
assert dtypes.is_struct_like(s.dtype)
429432

430433
actual = bbq.to_json_string(s)
431-
print("DINOSAUR")
432434
expected = bpd.Series(
433435
['{"project":"pandas","version":1}', '{"project":"numpy","version":2}'],
434436
dtype=dtypes.STRING_DTYPE,
435437
)
436438

437-
pd.testing.assert_series_equal(actual.to_pandas(), expected.to_pandas())
439+
actual_json = [json.loads(x) for x in actual.to_pandas()]
440+
expected_json = [json.loads(x) for x in expected.to_pandas()]
441+
assert actual_json == expected_json
438442

439443

440444
def test_json_keys():

0 commit comments

Comments
 (0)