def test_update(self): original = {'foo': 1, 'bar': 2} test = ReadOnlyDict(original) with self.assertRaises(Exception): test.update(foo=2) self.assertEqual(original, test)
def test_update(self): original = {'foo': 1, 'bar': 2} test = ReadOnlyDict(original) with self.assertRaises(Exception): test.update(foo=2) self.assertEqual(original, test)
class MockConfig(object): def __init__(self, topsrcdir='/path/to/topsrcdir', extra_substs={}): self.topsrcdir = topsrcdir self.topobjdir = '/path/to/topobjdir' self.substs = ReadOnlyDict({ 'MOZ_FOO': 'foo', 'MOZ_BAR': 'bar', 'MOZ_TRUE': '1', 'MOZ_FALSE': '', }) self.substs.update(extra_substs) self.substs_unicode = ReadOnlyDict({k.decode('utf-8'): v.decode('utf-8', 'replace') for k, v in self.substs.items()}) def child_path(self, p): return os.path.join(self.topsrcdir, p)
class MockConfig(object): def __init__(self, topsrcdir='/path/to/topsrcdir', extra_substs={}): self.topsrcdir = topsrcdir self.topobjdir = '/path/to/topobjdir' self.substs = ReadOnlyDict({ 'MOZ_FOO': 'foo', 'MOZ_BAR': 'bar', 'MOZ_TRUE': '1', 'MOZ_FALSE': '', }) self.substs.update(extra_substs) self.substs_unicode = ReadOnlyDict({ k.decode('utf-8'): v.decode('utf-8', 'replace') for k, v in self.substs.items() }) def child_path(self, p): return os.path.join(self.topsrcdir, p)