Annotation of embedaddon/libxml2/python/tests/tstURI.py, revision 1.1.1.1

1.1       misho       1: #!/usr/bin/python -u
                      2: import sys
                      3: import libxml2
                      4: 
                      5: # Memory debug specific
                      6: libxml2.debugMemory(1)
                      7: 
                      8: uri = libxml2.parseURI("http://example.org:8088/foo/bar?query=simple#fragid")
                      9: if uri.scheme() != 'http':
                     10:     print "Error parsing URI: wrong scheme"
                     11:     sys.exit(1)
                     12: if uri.server() != 'example.org':
                     13:     print "Error parsing URI: wrong server"
                     14:     sys.exit(1)
                     15: if uri.port() != 8088:
                     16:     print "Error parsing URI: wrong port"
                     17:     sys.exit(1)
                     18: if uri.path() != '/foo/bar':
                     19:     print "Error parsing URI: wrong path"
                     20:     sys.exit(1)
                     21: if uri.query() != 'query=simple':
                     22:     print "Error parsing URI: wrong query"
                     23:     sys.exit(1)
                     24: if uri.fragment() != 'fragid':
                     25:     print "Error parsing URI: wrong query"
                     26:     sys.exit(1)
                     27: uri.setScheme("https")
                     28: uri.setPort(223)
                     29: uri.setFragment(None)
                     30: result=uri.saveUri()
                     31: if result != "https://example.org:223/foo/bar?query=simple":
                     32:     print "Error modifying or saving the URI"
                     33: uri = None
                     34: 
                     35: # Memory debug specific
                     36: libxml2.cleanupParser()
                     37: if libxml2.debugMemory(1) == 0:
                     38:     print "OK"
                     39: else:
                     40:     print "Memory leak %d bytes" % (libxml2.debugMemory(1))
                     41:     libxml2.dumpMemory()

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>