コード例 #1
0
ファイル: test-utf8-leak-cinit.py プロジェクト: dmw/pyxser
def test_unicode(test):
    try:
        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 2)
        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(obj = test, enc = "utf-8", depth = 3)
        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(obj = test, enc = "utf-8", depth = 4)
        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(obj = test, enc = "utf-8", depth = 5)
        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(obj = test, enc = "utf-8", depth = 0)
        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)

        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
コード例 #2
0
ファイル: test-utf8-leak.py プロジェクト: kaymccormick/pyxser
def test_unicode(test):
    try:
        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 2)
        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(obj = test, enc = "utf-8", depth = 3)
        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(obj = test, enc = "utf-8", depth = 4)
        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(obj = test, enc = "utf-8", depth = 5)
        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(obj = test, enc = "utf-8", depth = 0)
        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")

        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
コード例 #3
0
def test_unicode(test):
    try:
        print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_unicode()"
        print "First Object:\n" + repr(test) + "\n\n"

        serialized = pyxser.u_serialize(obj=test, enc="ascii", depth=2)
        print "Serilized Object:\n", serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj=serialized, enc="ascii")
        print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj=test, enc="ascii", depth=3)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj=serialized, enc="ascii")
        print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj=test, enc="ascii", depth=4)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj=serialized, enc="ascii")
        print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj=test, enc="ascii", depth=5)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj=serialized, enc="ascii")
        print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj=test,
                                        enc="ascii",
                                        depth=0,
                                        cinit=False)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj=serialized,
                                            enc="ascii",
                                            typemap={},
                                            cinit=False)
        print "Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n"

        pyxser.xmlcleanup()

    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
コード例 #4
0
ファイル: test-utf8.py プロジェクト: kaymccormick/pyxser
def test_unicode(test):
    try:
        print(
            "-----8<----------8<----------8<----------8<----------8<----------8<----- test_unicode()"
        )
        print("First Object:\n" + repr(test) + "\n\n")

        serialized = pyxser.u_serialize(obj=test, enc="utf-8", depth=2)
        print("Serilized Object:\n", serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj=test, enc="utf-8", depth=3)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj=test, enc="utf-8", depth=4)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj=test, enc="utf-8", depth=5)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj=test, enc="utf-8", depth=0)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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)
        print("Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n")

        pyxser.xmlcleanup()

    except Exception:
        print("-" * 60)
        traceback.print_exc(file=sys.stdout)
        print("-" * 60)
コード例 #5
0
ファイル: test-ascii.py プロジェクト: dmw/pyxser
def test_unicode(test):
    try:
        print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_unicode()"
        print "First Object:\n" + repr(test) + "\n\n"

        serialized = pyxser.u_serialize(obj = test, enc = "ascii", depth = 2)
        print "Serilized Object:\n", serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "ascii")
        print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj = test, enc = "ascii", depth = 3)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "ascii")
        print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj = test, enc = "ascii", depth = 4)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "ascii")
        print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj = test, enc = "ascii", depth = 5)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "ascii")
        print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n"

        serialized = pyxser.u_serialize(obj = test, enc = "ascii", depth = 0,
                                        cinit = False)
        print "Serilized Object:\n" + serialized.encode("ascii")
        print "Serilized Object Validation:\n", \
              pyxser.u_validate(obj = serialized, enc = "ascii"), \
              pyxser.u_validate_dtd(obj = serialized, enc = "ascii")
        unserialized = pyxser.u_unserialize(obj = serialized, enc = "ascii",
                                            typemap = {}, cinit = False)
        print "Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n"

        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(test):
    try:
        print("-----8<----------8<----------8<----------8<----------8<----------8<----- test_unicode()")
        print("First Object:\n" + repr(test) + "\n\n")

        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 2)
        print("Serilized Object:\n", serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 3)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 4)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 5)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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")
        print("Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n")

        serialized = pyxser.u_serialize(obj = test, enc = "utf-8", depth = 0)
        print("Serilized Object:\n" + serialized.encode("latin1"))
        print("Serilized Object Validation:\n", \
              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)
        print("Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n")

        pyxser.xmlcleanup()

    except Exception:
        print("-" * 60)
        traceback.print_exc(file=sys.stdout)
        print("-" * 60)
コード例 #7
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
コード例 #8
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
コード例 #9
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
コード例 #10
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
コード例 #11
0
ファイル: test-utf8-leak-cinit.py プロジェクト: dmw/pyxser
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
コード例 #12
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)