Skip to content

Commit

Permalink
Get the code coverage to 100 %.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed Jul 13, 2016
1 parent 1bdcbfa commit ae786a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/grokcore/content/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def items(self):
return ((key, self[key]) for key in self._order)

def __setitem__(self, key, object):
contains = self.has_key(key)
# Then do whatever containers normally do.
# Do whatever containers normally do.
super(OrderedContainer, self).__setitem__(key, object)
if not contains:
self._order.append(key)
# If the key was already in the container, a KeyError will be returned
# so we can safely add the key to self._order now.
self._order.append(key)

def __delitem__(self, key):
# First do whatever containers normally do.
Expand Down
4 changes: 4 additions & 0 deletions src/grokcore/content/tests/test_orderedcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@
...
ValueError: Incompatible key set.
The OrderedContainer is also an iterator which returns the keys:
>>> [ bone for bone in morebones]
['thigh', 'knee', 'shin', 'ankle']
"""

from grokcore.content import Model, OrderedContainer
Expand Down

0 comments on commit ae786a1

Please sign in to comment.