Skip to content

Commit 45ea992

Browse files
committed
test: update test to work around numpy array encoding of nested arrays
1 parent 374608b commit 45ea992

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

bigquery/tests/system.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,12 @@ def test_nested_table_to_dataframe(self):
23692369
row = df.iloc[0]
23702370
# verify the row content
23712371
self.assertEqual(row["string_col"], "Some value")
2372-
self.assertEqual(row["record_col"], record)
2372+
expected_keys = tuple(sorted(record.keys()))
2373+
row_keys = tuple(sorted(row["record_col"].keys()))
2374+
self.assertEqual(row_keys, expected_keys)
2375+
# Can't compare numpy arrays, which pyarrow encodes the embedded
2376+
# repeated column to, so convert to list.
2377+
self.assertEqual(list(row["record_col"]["nested_repeated"]), [0, 1, 2])
23732378
# verify that nested data can be accessed with indices/keys
23742379
self.assertEqual(row["record_col"]["nested_repeated"][0], 0)
23752380
self.assertEqual(

0 commit comments

Comments
 (0)