Skip to content

Commit

Permalink
Return EntryValue from get_entry_value.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-feld committed Aug 27, 2019
1 parent 23ea35d commit 7eab1e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ def get_entries(self) -> typing.Iterable[Entry]:
def get_entry_value(
self,
key: EntryKey
) -> typing.Optional[Entry]:
) -> typing.Optional[EntryValue]:
"""Returns the entry associated with a key or None
Args:
key: the key with which to perform a lookup
"""
return self._container.get(key)
if key in self._container:
return self._container[key].value


class DistributedContextManager:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_get_entry_value_present(self):
value = self.context.get_entry_value(
self.entry.key,
)
self.assertIs(value, self.entry)
self.assertIs(value, self.entry.value)

def test_get_entry_value_missing(self):
key = distributedcontext.EntryKey("missing")
Expand Down

0 comments on commit 7eab1e8

Please sign in to comment.