mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 08:09:10 +02:00
ImmutableMap.update: test, lint
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user