Exemplo n.º 1
0
    def test_bunchify_tree_complex(self):
        """ complex feature _bunchify_tree test """

        data = [
            'foo', {
                'outer': 'val1',
                'inner': {
                    'key1': 'in1',
                    'key2': 'in2'
                }
            }, ['bar', {
                'listin': 'valin'
            }]
        ]

        data = ymlconfig._bunchify_tree(data)

        self.assertIsInstance(data, list)
        self.assertEqual(data[0], 'foo')
        self.assertIsInstance(data[1], Bunch)
        self.assertIsInstance(data[1].inner, Bunch)
        self.assertEqual(data[1].inner.key1, 'in1')
        self.assertIsInstance(data[2], list)
        self.assertIsInstance(data[2][1], Bunch)
        self.assertEqual(data[2][1].listin, 'valin')
Exemplo n.º 2
0
    def test_bunchify_tree(self):
        """ simple test feature _bunchify_tree """

        data = {'foo': 'foo', 'bar': 1}
        data = ymlconfig._bunchify_tree(data)

        self.assertEqual(data.foo, 'foo')
        self.assertEqual(data.bar, 1)
        self.assertIsInstance(data, Bunch)
Exemplo n.º 3
0
    def test_bunchify_tree(self):
        """ simple test feature _bunchify_tree """

        data = {'foo':'foo', 'bar': 1}
        data = ymlconfig._bunchify_tree(data)

        self.assertEqual(data.foo, 'foo')
        self.assertEqual(data.bar, 1)
        self.assertIsInstance(data, Bunch)
Exemplo n.º 4
0
    def test_bunchify_tree_complex(self):
        """ complex feature _bunchify_tree test """

        data = ['foo',
               {'outer':'val1','inner':
                                {'key1' : 'in1',
                                 'key2' : 'in2'}},
               ['bar', {'listin':'valin'}]]

        data = ymlconfig._bunchify_tree(data)

        self.assertIsInstance(data, list)
        self.assertEqual(data[0], 'foo')
        self.assertIsInstance(data[1], Bunch)
        self.assertIsInstance(data[1].inner, Bunch)
        self.assertEqual(data[1].inner.key1, 'in1')
        self.assertIsInstance(data[2], list)
        self.assertIsInstance(data[2][1], Bunch)
        self.assertEqual(data[2][1].listin, 'valin')