Ejemplo n.º 1
0
    def test_update(self):
        original = {'foo': 1, 'bar': 2}

        test = ReadOnlyDict(original)

        with self.assertRaises(Exception):
            test.update(foo=2)

        self.assertEqual(original, test)
Ejemplo n.º 2
0
    def test_update(self):
        original = {'foo': 1, 'bar': 2}

        test = ReadOnlyDict(original)

        with self.assertRaises(Exception):
            test.update(foo=2)

        self.assertEqual(original, test)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)