def test_simple_deserialize(name):
    # Load the result.
    filename = path.join(BASE_DIR, '%s-simple.xml' % name)
    parser = etree.XMLParser(ns_clean=True,
                             remove_blank_text=True,
                             remove_comments=True)
    target = etree.parse(filename, parser).getroot()

    # Build the expected result.
    build_fn_name = ('build-%s-simple' % name).replace('-', '_')
    expected = globals()[build_fn_name]().serialize()

    # Deserialize and subsequently serialize the target.
    cls_name = utils.pascalize(name)
    result = getattr(schema, cls_name).deserialize(target).serialize()

    # Compare the nodes.
    assert_node(expected, result)
Ejemplo n.º 2
0
    def test_underscore(self):
        text = 'some_thing'

        assert utils.pascalize(text) == 'SomeThing'
Ejemplo n.º 3
0
    def test_normal(self):
        text = 'something'

        assert utils.pascalize(text) == 'Something'
Ejemplo n.º 4
0
    def test_pascal(self):
        text = 'Some_thing'

        assert utils.pascalize(text) == 'SomeThing'
Ejemplo n.º 5
0
    def test_dash(self):
        text = 'some-thing'

        assert utils.pascalize(text) == 'SomeThing'
Ejemplo n.º 6
0
    def test_already(self):
        text = 'someThing'

        assert utils.pascalize(text) == 'SomeThing'