Skip to content

Commit

Permalink
Fix typo, work around branch coverage bug, rebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Rossi committed Jun 28, 2019
1 parent da7fa85 commit 83869fa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/google/cloud/ndb/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ def _entity_from_ds_entity(ds_entity, model_class=None):
prop = getattr(model_class, name, None)

# Backwards compatibility shim. NDB previously stored structured
# properties as sets of dotted name proprties. Datastore now has native
# support for embedded entities and NDB now uses that, by default. This
# handles the case of reading structured properties from older
# NDB datastore instances.
# properties as sets of dotted name properties. Datastore now has
# native support for embedded entities and NDB now uses that, by
# default. This handles the case of reading structured properties from
# older NDB datastore instances.
if prop is None and "." in name:
supername, subname = name.split(".", 1)
structprop = getattr(model_class, supername, None)
Expand All @@ -553,7 +553,11 @@ def _entity_from_ds_entity(ds_entity, model_class=None):
structprop._store_value(entity, value)

if structprop._repeated:
for subentity, subsubvalue in zip(value, subvalue):
# Branch coverage bug,
# See: https://github.com/nedbat/coveragepy/issues/817
for subentity, subsubvalue in zip( # pragma no branch
value, subvalue
):
subentity.b_val.update({subname: subsubvalue})
else:
value.b_val.update({subname: subvalue})
Expand Down

0 comments on commit 83869fa

Please sign in to comment.