ImmutableMap.update: test, lint

This commit is contained in:
Jakub Warmuz
2015-03-27 08:48:32 +00:00
parent ffff84ee55
commit b12e4ba357
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ class ImmutableMap(collections.Mapping, collections.Hashable):
"""Return updated map."""
items = dict(self)
items.update(kwargs)
return type(self)(**items)
return type(self)(**items) # pylint: disable=star-args
def __getitem__(self, key):
try:
+4
View File
@@ -25,6 +25,10 @@ class ImmutableMapTest(unittest.TestCase):
self.a2 = self.A(x=3, y=4)
self.b = self.B(x=1, y=2)
def test_update(self):
self.assertEqual(self.A(x=2, y=2), self.a1.update(x=2))
self.assertEqual(self.a2, self.a1.update(x=3, y=4))
def test_get_missing_item_raises_key_error(self):
self.assertRaises(KeyError, self.a1.__getitem__, 'z')