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)
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)
def test_normal(self): text = 'something' assert utils.pascalize(text) == 'Something'
def test_pascal(self): text = 'Some_thing' assert utils.pascalize(text) == 'SomeThing'
def test_dash(self): text = 'some-thing' assert utils.pascalize(text) == 'SomeThing'
def test_already(self): text = 'someThing' assert utils.pascalize(text) == 'SomeThing'
def test_underscore(self): text = 'some_thing' assert utils.pascalize(text) == 'SomeThing'