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
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
def test_normal(test): try: serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 2) 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(obj = test, enc = "utf-8", depth = 3) 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(obj = test, enc = "utf-8", depth = 4) 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(obj = test, enc = "utf-8", depth = 5) 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(obj = test, enc = "utf-8", depth = 0) pyxser.validate(obj = serialized, enc = "utf-8") pyxser.validate_dtd(obj = serialized, enc = "utf-8") unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") pyxser.xmlcleanup() except Exception, e: print "-" * 60 traceback.print_exc(file=sys.stdout) print "-" * 60
def test_normal(test): try: serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 2) 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(obj = test, enc = "utf-8", depth = 3) 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(obj = test, enc = "utf-8", depth = 4) 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(obj = test, enc = "utf-8", depth = 5) 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(obj = test, enc = "utf-8", depth = 0) 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) pyxser.xmlcleanup() except Exception, e: print "-" * 60 traceback.print_exc(file=sys.stdout) print "-" * 60
def test_selector(test): try: print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_selector()" print "First Object:\n" + repr(test) + "\n\n" x = sel(test) print repr(x) serialized = pyxser.serialize(obj = test, enc = "utf-16", depth = 2, selector = sel) print "Serilized Object:\n", serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj = serialized, enc = "utf-16") print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "utf-16", depth = 3, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj = serialized, enc = "utf-16") print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "utf-16", depth = 4, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj = serialized, enc = "utf-16") print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "utf-16", depth = 5, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj = serialized, enc = "utf-16") print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "utf-16", depth = 0, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj = serialized, enc = "utf-16", cinit = False) print "Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n" pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_normal(test): try: print( "-----8<----------8<----------8<----------8<----------8<----------8<----- test_normal()" ) print("First Object:\n" + repr(test) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=100) print("Serilized Object:%s\n" % (serialized)) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=3) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=4) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=5) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=0) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ 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) print("Unserialized Object (d.6):\n" + repr(unserialized) + "\n\n") pyxser.xmlcleanup() except Exception: print("-" * 60) traceback.print_exc(file=sys.stdout) print("-" * 60)
def test_selector(test): try: print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_selector()" print "First Object:\n" + repr(test) + "\n\n" x = sel(test) print repr(x) serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 2, selector = sel) print "Serilized Object:\n", serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 3, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 4, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 5, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 0, selector = sel) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n" pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_selector(test): try: print("-----8<----------8<----------8<----------8<----------8<----------8<----- test_selector()") print("First Object:\n" + repr(test) + "\n\n") x = sel(test) print(repr(x)) serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 2, selector = sel) print("Serilized Object:\n", serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 3, selector = sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 4, selector = sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 5, selector = sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8", typemap = {}, cinit = False) print("Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 0, selector = sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n") pyxser.xmlcleanup() except Exception: print("-" * 60) traceback.print_exc(file=sys.stdout) print("-" * 60)
def test_normal(test): try: print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_normal()" print "First Object:\n" + repr(test) + "\n\n" serialized = pyxser.serialize(obj=test, enc="utf-16", depth=2) print "Serilized Object:\n", serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj=serialized, enc="utf-16") print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj=test, enc="utf-16", depth=3) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj=serialized, enc="utf-16") print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj=test, enc="utf-16", depth=4) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj=serialized, enc="utf-16") print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj=test, enc="utf-16", depth=5) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj=serialized, enc="utf-16") print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj=test, enc="utf-16", depth=0) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-16"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-16") unserialized = pyxser.unserialize(obj=serialized, enc="utf-16", cinit=False) print "Unserialized Object (d.6):\n" + repr(unserialized) + "\n\n" pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_normal(test): try: print("-----8<----------8<----------8<----------8<----------8<----------8<----- test_normal()") print("First Object:\n" + repr(test) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 100) print("Serilized Object:%s\n" % (serialized)) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 3) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 4) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 5) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj = serialized, enc = "utf-8") print("Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 0) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ 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) print("Unserialized Object (d.6):\n" + repr(unserialized) + "\n\n") pyxser.xmlcleanup() except Exception: print("-" * 60) traceback.print_exc(file=sys.stdout) print("-" * 60)
def test_typemap(test): try: print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_typemap()" print "First Object:\n" + repr(test) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 2, typemap = test_typemap_map) print "Serilized Object:\n", serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii", typemap = test_typemap_map) print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 3, typemap = test_typemap_map) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii", typemap = test_typemap_map) print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 4, typemap = test_typemap_map) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii", typemap = test_typemap_map) print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 5, typemap = test_typemap_map) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii", typemap = test_typemap_map) print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 0, typemap = test_typemap_map) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii", typemap = test_typemap_map, cinit = False) print "Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n" pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_normal(test): try: print "-----8<----------8<----------8<----------8<----------8<----------8<----- test_normal()" print "First Object:\n" + repr(test) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 2) print "Serilized Object:\n", serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 3) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 4) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 5) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n" serialized = pyxser.serialize(obj = test, enc = "ascii", depth = 0) print "Serilized Object:\n" + serialized print "Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "ascii"), \ pyxser.validate_dtd(obj = serialized, enc = "ascii") unserialized = pyxser.unserialize(obj = serialized, enc = "ascii") print "Unserialized Object (d.6):\n" + repr(unserialized) + "\n\n" pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_selector(test): try: x = sel(test) print repr(x) serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 2, 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(obj = test, enc = "utf-8", depth = 3, 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(obj = test, enc = "utf-8", depth = 4, 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(obj = test, enc = "utf-8", depth = 5, 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(obj = test, enc = "utf-8", depth = 0, 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) pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_selector(test): try: x = sel(test) print repr(x) serialized = pyxser.serialize(obj = test, enc = "utf-8", depth = 2, 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(obj = test, enc = "utf-8", depth = 3, 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(obj = test, enc = "utf-8", depth = 4, 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(obj = test, enc = "utf-8", depth = 5, 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(obj = test, enc = "utf-8", depth = 0, 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") pyxser.xmlcleanup() except Exception, e: print "-" * 60 print e traceback.print_exc(file=sys.stdout) print "-" * 60
def test_selector(test): try: print( "-----8<----------8<----------8<----------8<----------8<----------8<----- test_selector()" ) print("First Object:\n" + repr(test) + "\n\n") x = sel(test) print(repr(x)) serialized = pyxser.serialize(obj=test, enc="utf-8", depth=2, selector=sel) print("Serilized Object:\n", serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.2):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=3, selector=sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.3):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=4, selector=sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.4):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=5, selector=sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8", typemap={}, cinit=False) print("Unserialized Object (d.5):\n" + repr(unserialized) + "\n\n") serialized = pyxser.serialize(obj=test, enc="utf-8", depth=0, selector=sel) print("Serilized Object:\n" + serialized) print("Serilized Object Validation:\n", \ pyxser.validate(obj = serialized, enc = "utf-8"), \ pyxser.validate_dtd(obj = serialized, enc = "utf-8")) unserialized = pyxser.unserialize(obj=serialized, enc="utf-8") print("Unserialized Object (d.0):\n" + repr(unserialized) + "\n\n") pyxser.xmlcleanup() except Exception: print("-" * 60) traceback.print_exc(file=sys.stdout) print("-" * 60)