@@ -80,18 +80,18 @@ def test_it(self):
80
80
unindexed_val_pb .integer_value = 10
81
81
unindexed_val_pb .exclude_from_indexes = True
82
82
83
- list_val_pb1 = _new_value_pb (entity_pb , 'baz' )
84
- list_pb1 = list_val_pb1 . list_value
83
+ array_val_pb1 = _new_value_pb (entity_pb , 'baz' )
84
+ array_pb1 = array_val_pb1 . array_value . values
85
85
86
- unindexed_list_val_pb = list_pb1 .add ()
87
- unindexed_list_val_pb .integer_value = 11
88
- unindexed_list_val_pb .exclude_from_indexes = True
86
+ unindexed_array_val_pb = array_pb1 .add ()
87
+ unindexed_array_val_pb .integer_value = 11
88
+ unindexed_array_val_pb .exclude_from_indexes = True
89
89
90
- list_val_pb2 = _new_value_pb (entity_pb , 'qux' )
91
- list_pb2 = list_val_pb2 . list_value
90
+ array_val_pb2 = _new_value_pb (entity_pb , 'qux' )
91
+ array_pb2 = array_val_pb2 . array_value . values
92
92
93
- indexed_list_val_pb = list_pb2 .add ()
94
- indexed_list_val_pb .integer_value = 12
93
+ indexed_array_val_pb = array_pb2 .add ()
94
+ indexed_array_val_pb .integer_value = 12
95
95
96
96
entity = self ._callFUT (entity_pb )
97
97
self .assertEqual (entity .kind , _KIND )
@@ -119,14 +119,14 @@ def test_mismatched_value_indexed(self):
119
119
entity_pb .key .partition_id .project_id = _PROJECT
120
120
entity_pb .key .path .add (kind = _KIND , id = _ID )
121
121
122
- list_val_pb = _new_value_pb (entity_pb , 'baz' )
123
- list_pb = list_val_pb . list_value
122
+ array_val_pb = _new_value_pb (entity_pb , 'baz' )
123
+ array_pb = array_val_pb . array_value . values
124
124
125
- unindexed_value_pb1 = list_pb .add ()
125
+ unindexed_value_pb1 = array_pb .add ()
126
126
unindexed_value_pb1 .integer_value = 10
127
127
unindexed_value_pb1 .exclude_from_indexes = True
128
128
129
- unindexed_value_pb2 = list_pb .add ()
129
+ unindexed_value_pb2 = array_pb .add ()
130
130
unindexed_value_pb2 .integer_value = 11
131
131
132
132
with self .assertRaises (ValueError ):
@@ -305,14 +305,14 @@ def test_inverts_to_protobuf(self):
305
305
306
306
# Add a list property.
307
307
val_pb4 = _new_value_pb (original_pb , 'list-quux' )
308
- list_val1 = val_pb4 .list_value .add ()
309
- list_val1 .exclude_from_indexes = True
310
- list_val1 .meaning = meaning = 22
311
- list_val1 .blob_value = b'\xe2 \x98 \x83 '
312
- list_val2 = val_pb4 .list_value .add ()
313
- list_val2 .exclude_from_indexes = True
314
- list_val2 .meaning = meaning
315
- list_val2 .blob_value = b'\xe2 \x98 \x85 '
308
+ array_val1 = val_pb4 .array_value . values .add ()
309
+ array_val1 .exclude_from_indexes = False
310
+ array_val1 .meaning = meaning = 22
311
+ array_val1 .blob_value = b'\xe2 \x98 \x83 '
312
+ array_val2 = val_pb4 .array_value .add ()
313
+ array_val2 .exclude_from_indexes = False
314
+ array_val2 .meaning = meaning
315
+ array_val2 .blob_value = b'\xe2 \x98 \x85 '
316
316
317
317
# Convert to the user-space Entity.
318
318
entity = entity_from_protobuf (original_pb )
@@ -491,10 +491,10 @@ def test_entity(self):
491
491
self .assertEqual (name , 'entity_value' )
492
492
self .assertTrue (value is entity )
493
493
494
- def test_list (self ):
494
+ def test_array (self ):
495
495
values = ['a' , 0 , 3.14 ]
496
496
name , value = self ._callFUT (values )
497
- self .assertEqual (name , 'list_value ' )
497
+ self .assertEqual (name , 'array_value ' )
498
498
self .assertTrue (value is values )
499
499
500
500
def test_object (self ):
@@ -574,14 +574,14 @@ def test_entity(self):
574
574
self .assertTrue (isinstance (entity , Entity ))
575
575
self .assertEqual (entity ['foo' ], 'Foo' )
576
576
577
- def test_list (self ):
577
+ def test_array (self ):
578
578
from gcloud .datastore ._generated import entity_pb2
579
579
580
580
pb = entity_pb2 .Value ()
581
- list_pb = pb .list_value
582
- item_pb = list_pb .add ()
581
+ array_pb = pb .array_value . values
582
+ item_pb = array_pb .add ()
583
583
item_pb .string_value = 'Foo'
584
- item_pb = list_pb .add ()
584
+ item_pb = array_pb .add ()
585
585
item_pb .string_value = 'Bar'
586
586
items = self ._callFUT (pb )
587
587
self .assertEqual (items , ['Foo' , 'Bar' ])
@@ -723,11 +723,11 @@ def test_entity_w_key(self):
723
723
self .assertEqual (list (prop_dict .keys ()), [name ])
724
724
self .assertEqual (prop_dict [name ].string_value , value )
725
725
726
- def test_list (self ):
726
+ def test_array (self ):
727
727
pb = self ._makePB ()
728
728
values = [u'a' , 0 , 3.14 ]
729
729
self ._callFUT (pb , values )
730
- marshalled = pb .list_value
730
+ marshalled = pb .array_value . values
731
731
self .assertEqual (len (marshalled ), len (values ))
732
732
self .assertEqual (marshalled [0 ].string_value , values [0 ])
733
733
self .assertEqual (marshalled [1 ].integer_value , values [1 ])
@@ -836,23 +836,23 @@ def test_single(self):
836
836
result = self ._callFUT (value_pb )
837
837
self .assertEqual (meaning , result )
838
838
839
- def test_empty_list_value (self ):
839
+ def test_empty_array_value (self ):
840
840
from gcloud .datastore ._generated import entity_pb2
841
841
842
842
value_pb = entity_pb2 .Value ()
843
- value_pb .list_value .add ()
844
- value_pb .list_value .pop ()
843
+ value_pb .array_value . values .add ()
844
+ value_pb .array_value . values .pop ()
845
845
846
846
result = self ._callFUT (value_pb , is_list = True )
847
847
self .assertEqual (None , result )
848
848
849
- def test_list_value (self ):
849
+ def test_array_value (self ):
850
850
from gcloud .datastore ._generated import entity_pb2
851
851
852
852
value_pb = entity_pb2 .Value ()
853
853
meaning = 9
854
- sub_value_pb1 = value_pb .list_value .add ()
855
- sub_value_pb2 = value_pb .list_value .add ()
854
+ sub_value_pb1 = value_pb .array_value . values .add ()
855
+ sub_value_pb2 = value_pb .array_value . values .add ()
856
856
857
857
sub_value_pb1 .meaning = sub_value_pb2 .meaning = meaning
858
858
sub_value_pb1 .string_value = u'hi'
@@ -861,14 +861,14 @@ def test_list_value(self):
861
861
result = self ._callFUT (value_pb , is_list = True )
862
862
self .assertEqual (meaning , result )
863
863
864
- def test_list_value_disagreeing (self ):
864
+ def test_array_value_disagreeing (self ):
865
865
from gcloud .datastore ._generated import entity_pb2
866
866
867
867
value_pb = entity_pb2 .Value ()
868
868
meaning1 = 9
869
869
meaning2 = 10
870
- sub_value_pb1 = value_pb .list_value .add ()
871
- sub_value_pb2 = value_pb .list_value .add ()
870
+ sub_value_pb1 = value_pb .array_value . values .add ()
871
+ sub_value_pb2 = value_pb .array_value . values .add ()
872
872
873
873
sub_value_pb1 .meaning = meaning1
874
874
sub_value_pb2 .meaning = meaning2
@@ -878,13 +878,13 @@ def test_list_value_disagreeing(self):
878
878
with self .assertRaises (ValueError ):
879
879
self ._callFUT (value_pb , is_list = True )
880
880
881
- def test_list_value_partially_unset (self ):
881
+ def test_array_value_partially_unset (self ):
882
882
from gcloud .datastore ._generated import entity_pb2
883
883
884
884
value_pb = entity_pb2 .Value ()
885
885
meaning1 = 9
886
- sub_value_pb1 = value_pb .list_value .add ()
887
- sub_value_pb2 = value_pb .list_value .add ()
886
+ sub_value_pb1 = value_pb .array_value . values .add ()
887
+ sub_value_pb2 = value_pb .array_value . values .add ()
888
888
889
889
sub_value_pb1 .meaning = meaning1
890
890
sub_value_pb1 .string_value = u'hi'
0 commit comments