diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-02-07 22:34:59 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-02-07 22:34:59 +0000 |
commit | 3146d5356fa192ef3f27f74ef634b3d7bd411c8e (patch) | |
tree | b1102bbf1d80170b702f563f5e142bdcd276226a /python/tests | |
parent | 9de2bd46fce5d8e9ba9185dbb6044570887603cc (diff) | |
download | libxslt-3146d5356fa192ef3f27f74ef634b3d7bd411c8e.tar.gz libxslt-3146d5356fa192ef3f27f74ef634b3d7bd411c8e.tar.bz2 libxslt-3146d5356fa192ef3f27f74ef634b3d7bd411c8e.zip |
fixup the script and rebuid the API cleanup provided accessors for a lot
* doc/libxslt-api.xml doc/libxslt-decl.txt doc/libxslt-refs.xml
doc/parsedecl.py: fixup the script and rebuid the API
* libxslt/extensions.h: cleanup
* python/generator.py python/libxslt-python-api.xml python/libxslt.c
python/libxsltclass.txt: provided accessors for a lot of the
tructures involved in the transformation. Stylesheet and
transformation python object don't free automatically the
encapsulated object when deallocated.
* python/tests/Makefile.am python/tests/basic.py
python/tests/extfunc.py python/tests/pyxsltproc.py:
updated the examples
Daniel
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/Makefile.am | 2 | ||||
-rwxr-xr-x | python/tests/basic.py | 2 | ||||
-rwxr-xr-x | python/tests/extfunc.py | 21 | ||||
-rwxr-xr-x | python/tests/pyxsltproc.py | 3 |
4 files changed, 23 insertions, 5 deletions
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index df032649..478e1087 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -26,6 +26,6 @@ clean: install-data-local: $(mkinstalldirs) $(DESTDIR)$(EXAMPLE_DIR) - -(for test in $(TESTSPY) $(XMLS); \ + -(for test in $(TESTSPY) $(XMLS) $(EXTRAS); \ do @INSTALL@ -m 0644 $$test $(DESTDIR)$(EXAMPLE_DIR) ; done) diff --git a/python/tests/basic.py b/python/tests/basic.py index 1c62cde4..9eea288d 100755 --- a/python/tests/basic.py +++ b/python/tests/basic.py @@ -11,7 +11,7 @@ style = libxslt.parseStylesheetDoc(styledoc) doc = libxml2.parseFile("test.xml") result = style.applyStylesheet(doc, None) style.saveResultToFilename("foo", result, 0) -style = None +style.freeStylesheet() doc.freeDoc() result.freeDoc() diff --git a/python/tests/extfunc.py b/python/tests/extfunc.py index 7e8b2845..c8f2fe24 100755 --- a/python/tests/extfunc.py +++ b/python/tests/extfunc.py @@ -6,7 +6,22 @@ import libxslt # Memory debug specific libxml2.debugMemory(1) -def f(str): +nodeName = None + +def f(ctx, str): + global nodeName + + # + # Small check to verify the context is correcly accessed + # + try: + pctxt = libxslt.xpathParserContext(_obj=ctx) + ctxt = pctxt.context() + tctxt = ctxt.transformContext() + nodeName = tctxt.insertNode().name + except: + pass + import string return string.upper(str) @@ -27,7 +42,7 @@ styledoc = libxml2.parseDoc(""" style = libxslt.parseStylesheetDoc(styledoc) doc = libxml2.parseDoc("<doc/>") result = style.applyStylesheet(doc, { "bar": "'success'" }) -style = None +style.freeStylesheet() doc.freeDoc() root = result.children @@ -37,6 +52,8 @@ if root.name != "article": if root.content != "SUCCESS": print "Unexpected root node content, extension function failed" sys.exit(1) +if nodeName != 'article': + print "The function callback failed to access its context" result.freeDoc() diff --git a/python/tests/pyxsltproc.py b/python/tests/pyxsltproc.py index fed201fd..fd21521e 100755 --- a/python/tests/pyxsltproc.py +++ b/python/tests/pyxsltproc.py @@ -283,7 +283,8 @@ def main(args = None): xsltProcess(doc, cur, args[i]) i = i + 1 - cur = None + if cur != None: + cur.freeStylesheet() params = None if __name__ == "__main__": |