Ejemplo n.º 1
0
    def test_l1_dict_nochange(self):
        '''
        Test that the outer OrderedDict is converted into
        a dict while the inner dict remains untouched.
        '''
        test_arg = self._odict('fake_key', {'fake_key': 'fake_val'})
        expected = {'fake_key': {'fake_key': 'fake_val'}}
        actual = obj_tree._dfs_transform(test_arg)

        self.assertEquals(expected, actual)
Ejemplo n.º 2
0
    def test_l1_l0_odict_to_dict(self):
        '''
        Test that both the inner and outer OrderedDicts are
        converted into dicts.
        '''
        test_val = self._odict('fake_key', 'fake_val')
        test_arg = self._odict('fake_key', test_val)
        expected = {'fake_key': {'fake_key': 'fake_val'}}
        actual = obj_tree._dfs_transform(test_arg)

        self.assertEquals(expected, actual)
Ejemplo n.º 3
0
    def test_l0_odict_to_dict(self):
        '''
        Test that the test_arg is converted into
        a dict.
        '''

        test_arg = self._odict('fake_key', 'fake_val')
        expected = {'fake_key': 'fake_val'}
        actual = obj_tree._dfs_transform(test_arg)

        self.assertEquals(expected, actual)
Ejemplo n.º 4
0
    def test_l1_odict_list_to_dict(self):
        '''
        Test that the inner list of OrderedDicts IS expanded into
        a single dict.
        '''
        test_val_0 = self._odict('fake_key_0', 'fake_val')
        test_val_1 = self._odict('fake_key_1', 'fake_val')
        test_arg = self._odict('fake_ref', [test_val_0, test_val_1])
        expected = {
            'fake_ref': {
                'fake_key_0': 'fake_val',
                'fake_key_1': 'fake_val'
            }
        }
        actual = obj_tree._dfs_transform(test_arg)

        self.assertEquals(expected, actual)
Ejemplo n.º 5
0
    def test_l1_dict_list_nochange(self):
        '''
        Test that the inner list of dicts IS NOT expanded into
        a single dict.
        '''
        test_val_0 = {'fake_key_0': 'fake_val'}
        test_val_1 = {'fake_key_1': 'fake_val'}
        test_arg = self._odict('fake_ref', [test_val_0, test_val_1])
        expected = {
            'fake_ref': [{
                'fake_key_0': 'fake_val'
            }, {
                'fake_key_1': 'fake_val'
            }]
        }
        actual = obj_tree._dfs_transform(test_arg)

        self.assertEquals(expected, actual)