Beispiel #1
0
 def test_to_string_definitions(self):
     config = MyServerConfig([
         DefinitionElement('a'),
         DefinitionTree(
             definitions=[DefinitionElement('b'),
                          DefinitionElement('c')])
     ])
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)
Beispiel #2
0
    def test_from_lxml_definitions(self):
        text = '''<MYSERVER>
  <DEFINE name="a" />
  <DEFINE>
    <DEFINE name="b" />
    <DEFINE name="c" />
  </DEFINE>
</MYSERVER>'''
        config = MyServerConfig.from_lxml_element(etree.XML(text))
        right = MyServerConfig([DefinitionElement('a'), DefinitionTree(
                    definitions = [DefinitionElement('b'),
                                   DefinitionElement('c')])])
        self.assertEqual(config, right)
Beispiel #3
0
    def test_from_lxml_definitions(self):
        text = '''<MYSERVER>
  <DEFINE name="a" />
  <DEFINE>
    <DEFINE name="b" />
    <DEFINE name="c" />
  </DEFINE>
</MYSERVER>'''
        config = MyServerConfig.from_lxml_element(etree.XML(text))
        right = MyServerConfig([
            DefinitionElement('a'),
            DefinitionTree(
                definitions=[DefinitionElement('b'),
                             DefinitionElement('c')])
        ])
        self.assertEqual(config, right)
Beispiel #4
0
 def test_from_lxml(self):
     text = '<MYSERVER />'
     config = MyServerConfig.from_lxml_element(etree.XML(text))
     right = MyServerConfig()
     self.assertEqual(config, right)
Beispiel #5
0
 def test_to_string(self):
     config = MyServerConfig()
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)
Beispiel #6
0
 def test_from_lxml(self):
     text = '<MYSERVER />'
     config = MyServerConfig.from_lxml_element(etree.XML(text))
     right = MyServerConfig()
     self.assertEqual(config, right)
Beispiel #7
0
 def test_to_string_definitions(self):
     config = MyServerConfig([DefinitionElement('a'), DefinitionTree(
                 definitions = [DefinitionElement('b'),
                                DefinitionElement('c')])])
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)
Beispiel #8
0
 def test_to_string(self):
     config = MyServerConfig()
     copy = MyServerConfig.from_lxml_element(config.to_lxml_element())
     self.assertEqual(config, copy)