[deps.pyl] roll protobuf
roll protobuf 3.3.0 -> 3.5.1
3.5.1 has google.protobuf.struct_pb2.Struct.update(dict)
Bug: 788034
Change-Id: I15fe1d05aa5024fe28a3a799da0cef146dace205
Reviewed-on: https://chromium-review.googlesource.com/938755
Commit-Queue: Nodir Turakulov <nodir@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Cr-Mirrored-From: https://chromium.googlesource.com/infra/infra
Cr-Mirrored-Commit: 06231e7e2cc52f49f15ba734874a31e22109fdc3
diff --git a/infra_libs/bigquery/test/helper_test.py b/infra_libs/bigquery/test/helper_test.py
index 450e49e..23d207f 100644
--- a/infra_libs/bigquery/test/helper_test.py
+++ b/infra_libs/bigquery/test/helper_test.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import datetime
+import json
import mock
import unittest
from mock import patch
@@ -106,17 +107,18 @@
repeated_container=testmessage_pb2.RepeatedContainer(nums=[1, 2]),
)
row = helper.message_to_dict(msg)
+
expected = {
'str': u'a',
'strs': [u'a', u'b'],
- 'num': 1,
- 'nums': [0, 1, 2],
+ 'num': 1L,
+ 'nums': [0L, 1L, 2L],
- 'nested': {'num': 1L, 'str': 'a'},
+ 'nested': {'num': 1L, 'str': u'a'},
'nesteds': [
- {'num': 1L, 'str': 'a'},
- {'num': 2L, 'str': 'b'},
+ {'num': 1L, 'str': u'a'},
+ {'num': 2L, 'str': u'b'},
],
# empty messages are omitted
@@ -124,14 +126,21 @@
'e': 'E1',
'es': ['E0', 'E2'],
- 'struct': '{\n "a": 0\n}',
- 'structs': ['{\n "a": 0\n}', '{\n "a": 1\n}'],
+ # structs are compared separately.
'timestamp': dt0.isoformat(),
'timestamps': [dt0.isoformat(), dt1.isoformat()],
- 'repeated_container': {'nums': [1, 2]},
+ 'repeated_container': {'nums': [1L, 2L]},
}
+
+ # compare structs as JSON values, not strings.
+ self.assertEqual(json.loads(row.pop('struct')), {'a': 0})
+ self.assertEqual(
+ [json.loads(s) for s in row.pop('structs')],
+ [{'a': 0}, {'a': 1}]
+ )
+
self.assertEqual(row, expected)
def test_message_to_dict_empty(self):