コード例 #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 main():
    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = [u'holá', u'chaó', another]
    test.dyn_prop2 = (u'hol`', u'sïn', 'trip', other)
    test.dyn_prop3 = {
        u'sáludó1': u'hólà',
        u'sàludà2': u'chäó',
        u'sáludò4': u'gòódbye',
        u'saludo5': thisc
    }
    test.dyn_prop4 = u'sómé tèxtè ïñ Unicodè'
    test.dyn_prop5 = u'Añother Texé Iñ ÜnìcóDËc'
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    try:
        crawl = 0
        while crawl <= 100000:
            test_normal(test)
            test_normal_c14n(test)
            test_unicode(test)
            test_unicode_c14n(test)
            test_typemap(test)
            pyxser.getdtd()
            pyxser.getdtd_c14n()
            pyxser.getxsd()
            pyxser.getxsd_c14n()
            pyxser.xmlcleanup()
            if (crawl % 1000) == 0:
                print "cicle: ", crawl
            crawl += 1
    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
コード例 #4
0
ファイル: test-utf8-leak-cinit.py プロジェクト: dmw/pyxser
def main():
    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = [u'holá', u'chaó', another]
    test.dyn_prop2 = (u'hol`', u'sïn', 'trip', other)
    test.dyn_prop3 = {u'sáludó1': u'hólà', u'sàludà2': u'chäó', u'sáludò4': u'gòódbye', u'saludo5': thisc}
    test.dyn_prop4 = u'sómé tèxtè ïñ Unicodè'
    test.dyn_prop5 = u'Añother Texé Iñ ÜnìcóDËc'
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    try:
        crawl = 0
        while crawl <= 100000:
            test_normal(test)
            test_normal_c14n(test)
            test_unicode(test)
            test_unicode_c14n(test)
            test_typemap(test)
            pyxser.getdtd()
            pyxser.getdtd_c14n()
            pyxser.getxsd()
            pyxser.getxsd_c14n()
            pyxser.xmlcleanup()
            if (crawl % 1000) == 0:
                print "cicle: ", crawl
            crawl += 1
    except Exception, e:
        print "-" * 60
        traceback.print_exc(file=sys.stdout)
        print "-" * 60
コード例 #5
0
def main():

    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = ['hola', 'chao', another]
    test.dyn_prop2 = ('hola', 'sin', 'trip', other)
    test.dyn_prop3 = {
        'saludo': 'hola',
        'saludo2': 'chao',
        'saludo3': 'goodbye',
        'saludo5': thisc
    }
    test.dyn_prop4 = 'some text in unicode'
    test.dyn_prop5 = 'some text in unicode'
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    test_normal(test)
    test_normal_c14n(test)
    test_unicode(test)
    test_unicode_c14n(test)
    test_typemap(test)
    test_selector(test)

    print pyxser.getdtd()
    print pyxser.getdtd_c14n()
    print pyxser.getxsd()
    print pyxser.getxsd_c14n()

    pyxser.xmlcleanup()
コード例 #6
0
ファイル: test-utf16.py プロジェクト: kaymccormick/pyxser
def main():

    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = [u'holá', u'chaó', another]
    test.dyn_prop2 = (u'hol`', u'sïn', 'trip', other)
    test.dyn_prop3 = {
        u'sáludó1': u'hólà',
        u'sáludó2': u'chäó',
        u'sòludò4': u'goodbye',
        'saludo5': thisc
    }
    test.dyn_prop4 = u'sómé tèxtè ïñ Unicodè'
    test.dyn_prop5 = u'Añother Texé Iñ ÜnìcóDËc'
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    test_normal(test)
    test_normal_c14n(test)
    test_unicode(test)
    test_unicode_c14n(test)
    test_typemap(test)
    test_selector(test)

    print pyxser.getdtd()
    print pyxser.getdtd_c14n()
    print pyxser.getxsd()
    print pyxser.getxsd_c14n()

    pyxser.xmlcleanup()
コード例 #7
0
ファイル: test-utf16.py プロジェクト: dmw/pyxser
def main():

    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = [u'holá', u'chaó', another]
    test.dyn_prop2 = (u'hol`', u'sïn', 'trip', other)
    test.dyn_prop3 = {u'sáludó1': u'hólà',
                      u'sáludó2': u'chäó',
                      u'sòludò4': u'goodbye',
                      'saludo5': thisc}
    test.dyn_prop4 = u'sómé tèxtè ïñ Unicodè'
    test.dyn_prop5 = u'Añother Texé Iñ ÜnìcóDËc'
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    test_normal(test)
    test_normal_c14n(test)
    test_unicode(test)
    test_unicode_c14n(test)
    test_typemap(test)
    test_selector(test)

    print pyxser.getdtd()
    print pyxser.getdtd_c14n()
    print pyxser.getxsd()
    print pyxser.getxsd_c14n()

    pyxser.xmlcleanup()
コード例 #8
0
ファイル: test-ascii.py プロジェクト: dmw/pyxser
def main():

    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = ['hola', 'chao', another]
    test.dyn_prop2 = ('hola', 'sin', 'trip', other)
    test.dyn_prop3 = {'saludo': 'hola',
                      'saludo2': 'chao',
                      'saludo3': 'goodbye',
                      'saludo5': thisc}
    test.dyn_prop4 = 'some text in unicode'
    test.dyn_prop5 = 'some text in unicode'
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    test_normal(test)
    test_normal_c14n(test)
    test_unicode(test)
    test_unicode_c14n(test)
    test_typemap(test)
    test_selector(test)

    print pyxser.getdtd()
    print pyxser.getdtd_c14n()
    print pyxser.getxsd()
    print pyxser.getxsd_c14n()

    pyxser.xmlcleanup()
コード例 #9
0
ファイル: test-utf8.py プロジェクト: krichter722/pyxser
def main():

    another = testpkg.sample.TestAnotherObject()
    another.first_element = 123
    another.second_element = 456

    other = testpkg.sample.TestAnotherObject()
    other.first_element = complex(5.82, 3.99)
    other.second_element = "cdf"

    thisa = testpkg.sample.TestAnotherObject()
    thisa.first_element = "xyz"
    thisa.second_element = complex(7.81, 2.01)

    thisb = testpkg.sample.TestAnotherObject()
    thisb.first_element = "456"
    thisb.second_element = "789"

    thisc = testpkg.sample.TestAnotherObject()
    thisc.first_element = "XXX"
    thisc.second_element = complex(32.1, 33.1)

    test = testpkg.sample.ParentObject("hola", "chao", 2354345L)
    test.child("hi", 4.5, 2354)
    test.nested("holahola", 345, "hola")
    test.subnested(other)
    another.dyn_prop1 = thisa
    test.dyn_prop1 = [u"holá", u"chaó", another]
    test.dyn_prop2 = (u"hol`", u"sïn", "trip", other)
    test.dyn_prop3 = {u"sáludó1": u"hólà", u"sáludó2": u"chäó", u"sòludò4": u"goodbye", "saludo5": thisc}
    test.dyn_prop4 = u"sómé tèxtè ïñ Unicodè"
    test.dyn_prop5 = u"Añother Texé Iñ ÜnìcóDËc"
    test.dyn_prop6 = 1.5
    test.dyn_prop7 = 1000

    test_normal(test)
    test_normal_c14n(test)
    test_unicode(test)
    test_unicode_c14n(test)
    test_typemap(test)
    test_selector(test)

    print pyxser.getdtd()
    print pyxser.getdtd_c14n()
    print pyxser.getxsd()
    print pyxser.getxsd_c14n()

    pyxser.xmlcleanup()