예제 #1
0
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)
예제 #2
0
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)
예제 #3
0
    def test_normal(self):
        text = 'something'

        assert utils.pascalize(text) == 'Something'
예제 #4
0
    def test_pascal(self):
        text = 'Some_thing'

        assert utils.pascalize(text) == 'SomeThing'
예제 #5
0
    def test_dash(self):
        text = 'some-thing'

        assert utils.pascalize(text) == 'SomeThing'
예제 #6
0
    def test_already(self):
        text = 'someThing'

        assert utils.pascalize(text) == 'SomeThing'
예제 #7
0
    def test_underscore(self):
        text = 'some_thing'

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