VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/python/tests/tstURI.py@ 108403

最後變更 在這個檔案從108403是 105420,由 vboxsync 提交於 8 月 前

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

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

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