mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1050922 - Add an update method to FlagsFactory.Flags. r=gps
This commit is contained in:
parent
3920eb41a0
commit
3f3545c38e
@ -370,6 +370,13 @@ class TestStrictOrderingOnAppendListWithFlagsFactory(unittest.TestCase):
|
||||
with self.assertRaises(AttributeError):
|
||||
l['b'].baz = False
|
||||
|
||||
l['b'].update(foo=False, bar=12)
|
||||
self.assertEqual(l['b'].foo, False)
|
||||
self.assertEqual(l['b'].bar, 12)
|
||||
|
||||
with self.assertRaises(AttributeError):
|
||||
l['b'].update(xyz=1)
|
||||
|
||||
|
||||
class TestHierarchicalStringListWithFlagsFactory(unittest.TestCase):
|
||||
def test_hierarchical_string_list_with_flags_factory(self):
|
||||
|
@ -375,6 +375,10 @@ def FlagsFactory(flags):
|
||||
__slots__ = flags.keys()
|
||||
_flags = flags
|
||||
|
||||
def update(self, **kwargs):
|
||||
for k, v in kwargs.iteritems():
|
||||
setattr(self, k, v)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name not in self.__slots__:
|
||||
raise AttributeError("'%s' object has no attribute '%s'" %
|
||||
|
Loading…
Reference in New Issue
Block a user