Skip to content

Commit 4416cc5

Browse files
committed
Fix update method
1 parent 9f33369 commit 4416cc5

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

test_twodict.py

+5
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ def test_update_unordered(self):
416416
def test_update_raises(self):
417417
self.assertRaises(TypeError, self.tdict.update, [('a', 10)], [('b', 20)])
418418

419+
def test_update_from_other(self):
420+
other = TwoWayOrderedDict([('a', 10), ('b', 20), ('c', 30)])
421+
self.tdict.update(other)
422+
self.assertViewEqualO(self.tdict.items(), [('a', 10), ('b', 20), ('c', 30)])
423+
419424

420425
class TestSetDefault(unittest.TestCase, ExtraAssertions):
421426

twodict.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def update(self, *args, **kwargs):
237237
raise TypeError("expected at most 1 arguments, got {0}".format(len(args)))
238238

239239
for item in args:
240-
if type(item) == dict:
240+
if isinstance(item, dict):
241241
item = item.items()
242242

243243
for key, value in item:

0 commit comments

Comments
 (0)