Changeset 2590:7b6bba35f3a0 in livinglogic.python.xist for test/test_xist.py

Show
Ignore:
Timestamp:
09/22/06 08:54:55 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

htmlspecials.pixel() now no longer uses colored pixels, instead color is
done via CSS. The URL for the one remaining transparent pixel can now be
specified via src (either as an XML attribute or via the converter context).

Rename attrs methods with() and without() to withnames() and withoutnames()
(for Python 2.5 compatibility).

Use elinks instead of w3m for asText() and move/rename this method to a
function ll.xist.ns.html.astext().

Try to make XIST independent from PyXML (however PyXML is still required
for parsing via expat and for dtd2xsc.py (because this requires xmlproc)).

Remove the long dperecated method withSep().

Use Py_ssize_t in the C source where appropriate.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • test/test_xist.py

    r2559 r2590  
    22# -*- coding: iso-8859-1 -*- 
    33 
    4 ## Copyright 1999-2005 by LivingLogic AG, Bayreuth/Germany. 
    5 ## Copyright 1999-2005 by Walter Dörwald 
     4## Copyright 1999-2006 by LivingLogic AG, Bayreuth/Germany. 
     5## Copyright 1999-2006 by Walter Dörwald 
    66## 
    77## All Rights Reserved 
     
    1111import sys, unittest, cStringIO, warnings 
    1212 
    13 from xml.sax import saxlib 
    1413from xml.parsers import expat 
    1514 
     
    150149 
    151150 
    152 def test_asText(): 
     151def test_astext(): 
    153152    for node in common.allnodes(): 
    154         node.asText() 
    155         node.asText(monochrome=True) 
    156         node.asText(squeezeBlankLines=True) 
    157         node.asText(lineNumbers=True) 
    158         node.asText(width=120) 
     153        html.astext(node) 
     154        html.astext(node, width=120) 
    159155 
    160156 
     
    435431    keys.remove("class_") 
    436432 
    437     keys1 = node.attrs.without(["class_"]).keys() 
     433    keys1 = node.attrs.withoutnames(["class_"]).keys() 
    438434    keys1.sort() 
    439435    assert keys == keys1 
    440436 
    441437    keys.remove((xml2, "space")) 
    442     keys2 = node.attrs.without(["class_", (xml, "space")]).keys() 
     438    keys2 = node.attrs.withoutnames(["class_", (xml, "space")]).keys() 
    443439    keys2.sort() 
    444440    assert keys == keys2 
     
    446442    keys.remove((xml2, "lang")) 
    447443    keys.remove((xml2, "base")) 
    448     keys3 = node.attrs.without(["class_"], [xml]).keys() 
     444    keys3 = node.attrs.withoutnames(["class_"], [xml]).keys() 
    449445    keys3.sort() 
    450446    assert keys == keys3 
    451447 
    452448    # Check that non existing attrs are handled correctly 
    453     keys4 = node.attrs.without(["class_", "src"], keepglobals=False).keys() 
     449    keys4 = node.attrs.withoutnames(["class_", "src"], keepglobals=False).keys() 
    454450    keys4.sort() 
    455451    assert keys == keys4 
     
    472468    keys.remove("lang") 
    473469 
    474     assert node.attrs.with(["lang"]).keys() == ["lang"] 
    475  
    476     keys1 = node.attrs.with(["lang", "align"]).keys() 
     470    assert node.attrs.withnames(["lang"]).keys() == ["lang"] 
     471 
     472    keys1 = node.attrs.withnames(["lang", "align"]).keys() 
    477473    keys1.sort() 
    478474    assert keys1 == ["align", "lang"] 
     
    480476    keys = ["lang", (xml2, "lang")] 
    481477    keys.sort() 
    482     keys2 = node.attrs.with(keys).keys() 
     478    keys2 = node.attrs.withnames(keys).keys() 
    483479    keys2.sort() 
    484480    assert keys2 == keys 
     
    486482    keys = ["lang", (xml2, "lang"), (xml2, "space")] 
    487483    keys.sort() 
    488     keys3 = node.attrs.with(["lang"], [xml]).keys() 
     484    keys3 = node.attrs.withnames(["lang"], [xml]).keys() 
    489485    keys3.sort() 
    490486    assert keys3 == keys