Skip to content

Commit

Permalink
Don't overwrite by default in UniqueObjectIndex.extend.
Browse files Browse the repository at this point in the history
  • Loading branch information
riga committed Jul 12, 2023
1 parent 32c8029 commit b4d8d75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion order/unique.py
Expand Up @@ -243,7 +243,7 @@ def add(self, *args, **kwargs):

return obj

def extend(self, objs, overwrite=True):
def extend(self, objs, overwrite=False):
"""
Adds multiple new objects to the index. All elements of the sequence *objs*, as well as
*overwrite*, are forwarded to :py:meth:`add` and the added objects are returned in a list.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_unique.py
Expand Up @@ -143,7 +143,7 @@ def test_extend(self):
C, idx = self.make_index()
self.assertEqual(len(idx), 3)

objs = idx.extend([C("baz", 3), C("test", 4)])
objs = idx.extend([C("baz", 3), C("test", 4)], overwrite=True)
self.assertEqual(len(idx), 4)

with self.assertRaises(DuplicateNameException):
Expand Down

0 comments on commit b4d8d75

Please sign in to comment.