VirtualBox

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

Last change on this file since 107935 was 105420, checked in by vboxsync, 7 months ago

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

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.1 KB
Line 
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)))
Note: See TracBrowser for help on using the repository browser.

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