示例#1
0
def test_all(test):
    try:
        serialized = pyxser.serialize(obj = test, enc = "utf-8", typemap = test_typemap_map, selector = sel)
        pyxser.validate(obj = serialized, enc = "utf-8")
        pyxser.validate_dtd(obj = serialized, enc = "utf-8")
        unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8", cinit = False)

        serialized = pyxser.serialize_c14n(obj = test, depth = 0, com = 0)
        pyxser.validate_c14n(obj = serialized, enc = "utf-8")
        pyxser.validate_c14n_dtd(obj = serialized, enc = "utf-8")

        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", typemap = test_typemap_map, selector = sel)
        pyxser.u_validate(obj = serialized, enc = "utf-8")
        pyxser.u_validate_dtd(obj = serialized, enc = "utf-8")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "utf-8", cinit = False)

        serialized = pyxser.u_serialize_c14n(obj = test, depth = 0, com = 0)
        pyxser.u_validate_c14n(obj = serialized, enc = "utf-8")
        pyxser.u_validate_c14n_dtd(obj = serialized, enc = "utf-8")

        pyxser.getdtd()
        pyxser.getdtd_c14n()
        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
示例#2
0
def test_all(test):
    try:
        serialized = pyxser.serialize(obj=test,
                                      enc="utf-8",
                                      typemap=test_typemap_map,
                                      selector=sel)
        pyxser.validate(obj=serialized, enc="utf-8")
        pyxser.validate_dtd(obj=serialized, enc="utf-8")
        unserialized = pyxser.unserialize(obj=serialized, enc="utf-8")

        serialized = pyxser.serialize_c14n(obj=test, depth=0, com=0)
        pyxser.validate_c14n(obj=serialized, enc="utf-8")
        pyxser.validate_c14n_dtd(obj=serialized, enc="utf-8")

        serialized = pyxser.u_serialize(obj=test,
                                        enc="utf-8",
                                        typemap=test_typemap_map,
                                        selector=sel)
        pyxser.u_validate(obj=serialized, enc="utf-8")
        pyxser.u_validate_dtd(obj=serialized, enc="utf-8")
        unserialized = pyxser.u_unserialize(obj=serialized, enc="utf-8")

        serialized = pyxser.u_serialize_c14n(obj=test, depth=0, com=0)
        pyxser.u_validate_c14n(obj=serialized, enc="utf-8")
        pyxser.u_validate_c14n_dtd(obj=serialized, enc="utf-8")

        pyxser.getdtd()
        pyxser.getdtd_c14n()
        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
示例#3
0
def test_unicode_c14n(test):
    try:
        print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_unicode_c14n()"
        serialized = pyxser.u_serialize_c14n(obj=test, depth=0, com=1)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "First Object:\n" + repr(test) + "\n\n"
        print "Serilized Object Validation:\n", \
              pyxser.u_validate_c14n(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_c14n_dtd(obj = serialized, enc = "ascii")

        unserialized = pyxser.u_unserialize(obj=serialized, enc="ascii")
        print "Unserialized Object:\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize_c14n_strict(obj=test, depth=0, com=0)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", pyxser.u_validate_c14n(
            obj=serialized, enc="ascii")
        print "First Object:\n" + repr(test) + "\n\n"

        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
def test_unicode_c14n(test):
    try:
        serialized = pyxser.u_serialize_c14n(obj=test, depth=0, com=0)
        pyxser.u_validate_c14n(obj=serialized, enc="utf-8")
        pyxser.u_validate_c14n_dtd(obj=serialized, enc="utf-8")
        unserialized = pyxser.u_unserialize(obj=serialized, enc="utf-8")

        serialized = pyxser.u_serialize_c14n_strict(obj=test, depth=0, com=0)
        pyxser.u_validate_c14n(obj=serialized, enc="utf-8")

        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
示例#5
0
def test_unicode_c14n(test):
    try:
        serialized = pyxser.u_serialize_c14n(obj = test, depth = 0, com = 0)
        pyxser.u_validate_c14n(obj = serialized, enc = "utf-8")
        pyxser.u_validate_c14n_dtd(obj = serialized, enc = "utf-8")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "utf-8")

        serialized = pyxser.u_serialize_c14n_strict(obj = test, depth = 0, com = 0)
        pyxser.u_validate_c14n(obj = serialized, enc = "utf-8")

        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
示例#6
0
文件: test-utf8.py 项目: dmw/pyxser
def test_unicode_c14n(test):
    try:
        print("-----8<----------8<----------8<----------8<----------8<----------8<----- test_unicode_c14n()")
        serialized = pyxser.u_serialize_c14n(obj = test, depth = 0, com = 1)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("First Object:\n" + repr(test) + "\n\n")
        print("Serilized Object Validation:\n", \
              pyxser.u_validate_c14n(obj = serialized, enc = "utf-8"), \
              pyxser.u_validate_c14n_dtd(obj = serialized, enc = "utf-8"))

        unserialized = pyxser.u_unserialize(obj = serialized, enc = "utf-8")
        print("Unserialized Object:\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize_c14n_strict(obj = test, depth = 0, com = 0)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", pyxser.u_validate_c14n(obj = serialized, enc = "utf-8"))
        print("First Object:\n" + repr(test) + "\n\n")

        pyxser.xmlcleanup()

    except Exception:
        print("-" * 60)
        traceback.print_exc(file=sys.stdout)
        print("-" * 60)