Merge pull request #69 from kamalmarhubi/_from_list-tidy
Tidy up _from_list
This commit is contained in:
@@ -873,10 +873,10 @@ cdef _to_dict(msg, bint verbose, bint ordered):
|
|||||||
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
cdef _from_list(_DynamicListBuilder msg, list d):
|
cdef _from_list(_DynamicListBuilder msg, list d):
|
||||||
cdef size_t count = 0
|
for i, x in enumerate(d):
|
||||||
for i in range(len(d)):
|
msg._set(i, x)
|
||||||
msg._set(i, d[i])
|
|
||||||
|
|
||||||
|
|
||||||
cdef class _DynamicEnum:
|
cdef class _DynamicEnum:
|
||||||
|
|||||||
@@ -107,6 +107,14 @@ def test_builder_set(addressbook):
|
|||||||
person.foo = 'test'
|
person.foo = 'test'
|
||||||
|
|
||||||
|
|
||||||
|
def test_builder_set_from_list(all_types):
|
||||||
|
msg = all_types.TestAllTypes.new_message()
|
||||||
|
|
||||||
|
msg.int32List = [0, 1, 2]
|
||||||
|
|
||||||
|
assert list(msg.int32List) == [0, 1, 2]
|
||||||
|
|
||||||
|
|
||||||
def test_null_str(all_types):
|
def test_null_str(all_types):
|
||||||
msg = all_types.TestAllTypes.new_message()
|
msg = all_types.TestAllTypes.new_message()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user