VirtualBox

source: vbox/trunk/src/libs/libxml2-2.9.4/python/tests/tstURI.py@ 71370

最後變更 在這個檔案從71370是 65950,由 vboxsync 提交於 8 年 前

libxml 2.9.4: fix export

  • 屬性 svn:eol-style 設為 LF
  • 屬性 svn:executable 設為 *
檔案大小: 1.1 KB
 
1#!/usr/bin/python -u
2import sys
3import libxml2
4
5# Memory debug specific
6libxml2.debugMemory(1)
7
8uri = libxml2.parseURI("http://example.org:8088/foo/bar?query=simple#fragid")
9if uri.scheme() != 'http':
10 print("Error parsing URI: wrong scheme")
11 sys.exit(1)
12if uri.server() != 'example.org':
13 print("Error parsing URI: wrong server")
14 sys.exit(1)
15if uri.port() != 8088:
16 print("Error parsing URI: wrong port")
17 sys.exit(1)
18if uri.path() != '/foo/bar':
19 print("Error parsing URI: wrong path")
20 sys.exit(1)
21if uri.query() != 'query=simple':
22 print("Error parsing URI: wrong query")
23 sys.exit(1)
24if uri.fragment() != 'fragid':
25 print("Error parsing URI: wrong query")
26 sys.exit(1)
27uri.setScheme("https")
28uri.setPort(223)
29uri.setFragment(None)
30result=uri.saveUri()
31if result != "https://example.org:223/foo/bar?query=simple":
32 print("Error modifying or saving the URI")
33uri = None
34
35# Memory debug specific
36libxml2.cleanupParser()
37if libxml2.debugMemory(1) == 0:
38 print("OK")
39else:
40 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
41 libxml2.dumpMemory()
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette