Beispiel #1
0
    def test_dict_copy_keys(self):
        from_dict = {"a": "lala", "b": 10, "c": {"x": 1, "y": 2}, (1, 2): 11}
        to_dict = {(1, 2): None, "a": None, "c": {"x": None}}
        orig_to_dict = copy.deepcopy(to_dict)

        dict_copy_keys(to_dict, from_dict)

        T.assert_equal(sorted(to_dict.keys()), sorted(orig_to_dict))
        T.assert_equal(to_dict["a"], from_dict["a"])
        T.assert_equal(to_dict[(1, 2)], from_dict[(1, 2)])
        T.assert_equal(to_dict["c"]["x"], from_dict["c"]["x"])
        T.assert_equal(to_dict["c"].get("y", None), None)
Beispiel #2
0
    def test_dict_copy_keys(self):
        from_dict = {
            'a': 'lala',
            'b': 10,
            'c': {
                'x': 1,
                'y': 2,
            },
            (1, 2): 11,
        }
        to_dict = {(1, 2): None, 'a': None, 'c': {'x': None}}
        orig_to_dict = copy.deepcopy(to_dict)

        dict_copy_keys(to_dict, from_dict)

        T.assert_equal(sorted(to_dict.keys()), sorted(orig_to_dict))
        T.assert_equal(to_dict['a'], from_dict['a'])
        T.assert_equal(to_dict[(1, 2)], from_dict[(1, 2)])
        T.assert_equal(to_dict['c']['x'], from_dict['c']['x'])
        T.assert_equal(to_dict['c'].get('y', None), None)
Beispiel #3
0
        sys.exit(1)


# JS files in static/js need to know some of the configuration options
# too, but we do not have to export everything, just what's
# needed. This is what's needed. We're only setting up/defining keys
# here and will copy values from Settings.
JSSettings = {
    'main_app': {
        'servername': None,
        'port': None,
    },
    'buildbot': {
        'servername': None,
    },
    'reviewboard': {
        'servername': None,
    },
    'trac': {
        'servername': None,
    },
    'git': {
        'main_repository': None,
    },
    'check_sites_bookmarklet': None,
}

dict_copy_keys(to_dict=JSSettings, from_dict=Settings)

__all__ = ['Settings', 'JSSettings']
Beispiel #4
0
                      example_configuration_file)
        sys.exit(1)

# JS files in static/js need to know some of the configuration options
# too, but we do not have to export everything, just what's
# needed. This is what's needed. We're only setting up/defining keys
# here and will copy values from Settings.
JSSettings = {
    'main_app': {
        'servername': None,
        'port': None,
    },
    'buildbot': {
        'servername': None,
    },
    'reviewboard': {
        'servername': None,
    },
    'trac': {
        'servername': None,
    },
    'git': {
        'main_repository': None,
    },
    'check_sites_bookmarklet': None,
}

dict_copy_keys(to_dict=JSSettings, from_dict=Settings)

__all__ = ['Settings', 'JSSettings']