Skip to content

Commit

Permalink
test: update test to work around numpy array encoding of nested arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
tswast committed Jan 7, 2020
1 parent 374608b commit 45ea992
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bigquery/tests/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2369,7 +2369,12 @@ def test_nested_table_to_dataframe(self):
row = df.iloc[0]
# verify the row content
self.assertEqual(row["string_col"], "Some value")
self.assertEqual(row["record_col"], record)
expected_keys = tuple(sorted(record.keys()))
row_keys = tuple(sorted(row["record_col"].keys()))
self.assertEqual(row_keys, expected_keys)
# Can't compare numpy arrays, which pyarrow encodes the embedded
# repeated column to, so convert to list.
self.assertEqual(list(row["record_col"]["nested_repeated"]), [0, 1, 2])
# verify that nested data can be accessed with indices/keys
self.assertEqual(row["record_col"]["nested_repeated"][0], 0)
self.assertEqual(
Expand Down

0 comments on commit 45ea992

Please sign in to comment.