コード例 #1
0
    def test_element_to_dict(self):
        # Test when there is not a None
        exp = {'instance': {'flavor': {'links': [], 'value': {'value': '5'}}}}
        self.assertEqual(exp, xml.element_to_dict(self.ROOT))

        # Test when there is a None
        element = '''
                <server>
                    None
                </server>
            '''
        rt = etree.fromstring(element)
        self.assertEqual(None, xml.element_to_dict(rt))
コード例 #2
0
    def test_element_to_dict(self):
        # Test when there is not a None
        exp = {'instance': {'flavor': {'links': [], 'value': {'value': '5'}}}}
        self.assertEqual(exp, xml.element_to_dict(self.ROOT))

        # Test when there is a None
        element = '''
                <server>
                    None
                </server>
            '''
        rt = etree.fromstring(element)
        self.assertEqual(None, xml.element_to_dict(rt))
コード例 #3
0
 def test_element_to_dict(self):
     exp = {'instance': {'flavor': {'links': [], 'value': {'value': '5'}}}}
     self.assertEqual(exp, xml.element_to_dict(self.ROOT))