def test(): print 'testing source code syntax' from xml.dom.html import HTMLFormElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('Form') print 'testing get/set' testAttribute(f, 'name') testAttribute(f, 'acceptCharset') testAttribute(f, 'action') testAttribute(f, 'encType') testAttribute(f, 'target') f._set_method("TEST") rt = f._get_method() if rt != "Test": error('get/set of method failed') print 'get/sets work' print 'test getElements' i = doc.createElement('IsIndex') f.appendChild(i) hc = f._get_elements() if hc.length != 1: error('getElements failed') if f._get_length() != 1: error('getLength failed') print 'getElements works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLFormElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('Form') print 'testing get/set' testAttribute(f,'name') testAttribute(f,'acceptCharset') testAttribute(f,'action') testAttribute(f,'encType') testAttribute(f,'target') f._set_method("TEST") rt = f._get_method() if rt != "Test": error('get/set of method failed') print 'get/sets work' print 'test getElements' i = doc.createElement('IsIndex') f.appendChild(i) hc = f._get_elements() if hc.length != 1: error('getElements failed') if f._get_length() != 1: error('getLength failed') print 'getElements works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLQuoteElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') q = doc.createElement('Q') print 'testing get/set' testAttribute(q,'cite') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLQuoteElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('BlockQuote'); print 'testing get/set' testAttribute(b,'cite'); print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLFrameSetElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('FrameSet') print 'testing get/set' testAttribute(f, 'cols') testAttribute(f, 'rows') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLBaseElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('Base') print 'testing get/set attributes' testAttribute(b, 'href') testAttribute(b, 'target') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLModElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') m = doc.createElement('ins') print 'testing get/set' testAttribute(m, 'cite') testAttribute(m, 'dateTime') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLModElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') m = doc.createElement('ins') print 'testing get/set' testAttribute(m,'cite') testAttribute(m,'dateTime') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLBaseElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('Base') print 'testing get/set attributes' testAttribute(b,'href') testAttribute(b,'target') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLFrameSetElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('FrameSet') print 'testing get/set' testAttribute(f,'cols') testAttribute(f,'rows') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLLabelElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') l = doc.createElement('LABEL') print 'testing get/set attributes' testAttribute(l, 'accessKey') testAttribute(l, 'htmlFor') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLLabelElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') l = doc.createElement('LABEL') print 'testing get/set attributes' testAttribute(l,'accessKey') testAttribute(l,'htmlFor') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLLIElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') l = doc.createElement('LI') print 'testing get/set' testAttribute(l,'type') testIntAttribute(l,'value') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLOListElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') o = doc.createElement('OL') print 'testing get and set' testIntAttribute(o, 'compact') testIntAttribute(o, 'start') testAttribute(o, 'type') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLOListElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') o = doc.createElement('OL') print 'testing get and set' testIntAttribute(o,'compact') testIntAttribute(o,'start') testAttribute(o,'type') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLLegendElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') l = doc.createElement('LEGEND') print 'testing get/set' testAttribute(l,'accessKey') l._set_align('left') rt = l._get_align() if rt != 'Left': error('get/set of align failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLHRElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') h = doc.createElement('HR') print 'testing get/set' h._set_align('left') rt = h._get_align() if rt != 'Left': error('get/set align failed') testIntAttribute(h,'noShade') testAttribute(h,'size') testAttribute(h,'width') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLParamElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') p = doc.createElement('PARAM') print "testing get/set" testAttribute(p,'type') testAttribute(p,'value') p._set_valueType('object') rt = p._get_valueType() if rt != 'Object': error('get/set valueType failed') print "get/sets work"
def test(): print 'testing source code syntax' from xml.dom.html import HTMLHRElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') h = doc.createElement('HR') print 'testing get/set' h._set_align('left') rt = h._get_align() if rt != 'Left': error('get/set align failed') testIntAttribute(h, 'noShade') testAttribute(h, 'size') testAttribute(h, 'width') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLParamElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') p = doc.createElement('PARAM') print "testing get/set" testAttribute(p, 'type') testAttribute(p, 'value') p._set_valueType('object') rt = p._get_valueType() if rt != 'Object': error('get/set valueType failed') print "get/sets work"
def test(): print 'testing source code syntax' from xml.dom.html import HTMLIsIndexElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') i = doc.createElement('IsIndex') f = doc.createElement('Form') print 'testing get/set of Prompt' testAttribute(i,'prompt'); print 'get/set Prompt works' print 'testing getForm' f.appendChild(i) if i._get_form().nodeName != f.nodeName: error('getForm failed') print 'getForm works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLIsIndexElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') i = doc.createElement('IsIndex') f = doc.createElement('Form') print 'testing get/set of Prompt' testAttribute(i, 'prompt') print 'get/set Prompt works' print 'testing getForm' f.appendChild(i) if i._get_form().nodeName != f.nodeName: error('getForm failed') print 'getForm works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLScriptElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') s = doc.createElement('SCRIPT') print "testing get/set" testAttribute(s,'text') testAttribute(s,'charset') testAttribute(s,'src') testAttribute(s,'type') testIntAttribute(s,'defer') print "get/sets work"
def test(): print "testing syntax" from xml.dom.html.HTMLAreaElement import HTMLAreaElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') p = doc.createElement('Area') print "testing get/set" testAttribute(p, 'accessKey') testAttribute(p, 'alt') testAttribute(p, 'coords') testAttribute(p, 'href') testAttribute(p, 'target') testIntAttribute(p, 'noHref') testIntAttribute(p, 'tabIndex') p._set_shape('circle') rt = p._get_shape() if rt != 'Circle': error('get/set shape failed') print "get/sets work"
def test(): print 'testing source code syntax' from xml.dom.html import HTMLScriptElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') s = doc.createElement('SCRIPT') print "testing get/set" testAttribute(s, 'text') testAttribute(s, 'charset') testAttribute(s, 'src') testAttribute(s, 'type') testIntAttribute(s, 'defer') print "get/sets work"
def test(): print 'testing source code syntax' from xml.dom.html import HTMLStyleElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') s = doc.createElement('STYLE') print 'testing get/set of attributes' testAttribute(s, 'media') testAttribute(s, 'type') if s._get_disabled() != 0: error('getDisabled failed on false') s._set_disabled(1) if s._get_disabled() != 1: error('getDisabled failed on true') s._set_disabled(0) if s._get_disabled() != 0: error('getDisabled failed on false') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLOptGroupElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') o = doc.createElement('OPTGROUP') print 'testing get/set disabled' if o._get_disabled() != 0: error('get disabled failed with nothing set') o._set_disabled(1) if o._get_disabled() != 1: error('get disabled failed when set to 1') o._set_disabled(0); if o._get_disabled() != 0: error('get/set disabled failed when set to 0') print 'get/set disabled works' print 'testing get/set label' testAttribute(o, 'label') print 'get/set label works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLStyleElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') s = doc.createElement('STYLE') print 'testing get/set of attributes' testAttribute(s,'media') testAttribute(s,'type') if s._get_disabled() != 0: error('getDisabled failed on false'); s._set_disabled(1); if s._get_disabled() != 1: error('getDisabled failed on true'); s._set_disabled(0); if s._get_disabled() != 0: error('getDisabled failed on false'); print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLBaseFontElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('BaseFont') print 'testing get/set' testAttribute(b, 'color') testAttribute(b, 'face') testAttribute(b, 'size') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLBaseFontElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('BaseFont') print 'testing get/set' testAttribute(b,'color'); testAttribute(b,'face'); testAttribute(b,'size'); print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLMetaElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') m = doc.createElement('META') print 'testing get/set of attributes' testAttribute(m,'content') testAttribute(m,'httpEquiv') testAttribute(m,'scheme') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLMetaElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') m = doc.createElement('META') print 'testing get/set of attributes' testAttribute(m, 'content') testAttribute(m, 'httpEquiv') testAttribute(m, 'scheme') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLFrameElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('Frame') print 'testing get/set' testAttribute(f,'longDesc') testAttribute(f,'marginHeight') testAttribute(f,'marginWidth') testIntAttribute(f,'noResize') testAttribute(f,'src') f._set_frameBorder('left') rt = f._get_frameBorder() if rt != 'Left': error('get/set frameBorder failed') f._set_scrolling('auto') rt = f._get_scrolling() if rt != 'Auto': error('get/set scrolling failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLFrameElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('Frame') print 'testing get/set' testAttribute(f, 'longDesc') testAttribute(f, 'marginHeight') testAttribute(f, 'marginWidth') testIntAttribute(f, 'noResize') testAttribute(f, 'src') f._set_frameBorder('left') rt = f._get_frameBorder() if rt != 'Left': error('get/set frameBorder failed') f._set_scrolling('auto') rt = f._get_scrolling() if rt != 'Auto': error('get/set scrolling failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLButtonElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('Button'); print 'testing get/set attributes' testAttribute(b,'accessKey'); testIntAttribute(b,'disabled'); testAttribute(b,'name'); testIntAttribute(b,'tabIndex'); testAttribute(b,'value'); print 'get/sets works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTextAreaElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') t = doc.createElement('TEXTAREA') print 'testing get/set of attributes' testAttribute(t, 'defaultValue') testAttribute(t, 'accessKey') testIntAttribute(t, 'cols') testIntAttribute(t, 'disabled') testAttribute(t, 'name') testIntAttribute(t, 'readonly') testIntAttribute(t, 'rows') testIntAttribute(t, 'tabIndex') print 'get/set work' print 'testing clone node' t2 = t.cloneNode(1) if t2._get_defaultValue() != t._get_defaultValue(): error('cloneNode did not set the default value') print 'cloneNode works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTextAreaElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') t = doc.createElement('TEXTAREA') print 'testing get/set of attributes' testAttribute(t,'defaultValue'); testAttribute(t,'accessKey'); testIntAttribute(t,'cols'); testIntAttribute(t,'disabled'); testAttribute(t,'name'); testIntAttribute(t,'readonly'); testIntAttribute(t,'rows'); testIntAttribute(t,'tabIndex'); print 'get/set work' print 'testing clone node' t2 = t.cloneNode(1) if t2._get_defaultValue() != t._get_defaultValue(): error('cloneNode did not set the default value'); print 'cloneNode works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableColElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') c = doc.createElement('COL') print 'testing get/set' testAttribute(c, 'ch') testAttribute(c, 'chOff') testIntAttribute(c, 'span') testAttribute(c, 'width') c._set_align('left') rt = c._get_align() if rt != 'Left': error('get/set align failed') c._set_vAlign('top') rt = c._get_vAlign() if rt != 'Top': error('get/set vAlign failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableColElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') c = doc.createElement('COL'); print 'testing get/set' testAttribute(c,'ch'); testAttribute(c,'chOff'); testIntAttribute(c,'span'); testAttribute(c,'width'); c._set_align('left') rt = c._get_align() if rt != 'Left': error('get/set align failed') c._set_vAlign('top') rt = c._get_vAlign() if rt != 'Top': error('get/set vAlign failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLObjectElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') o = doc.createElement('OBJECT') print 'testing get/set' testAttribute(o, 'code') testAttribute(o, 'archive') testAttribute(o, 'border') testAttribute(o, 'codeBase') testAttribute(o, 'codeType') testAttribute(o, 'data') testIntAttribute(o, 'declare') testAttribute(o, 'height') testAttribute(o, 'hspace') testAttribute(o, 'standby') testIntAttribute(o, 'tabIndex') testAttribute(o, 'type') testAttribute(o, 'useMap') testAttribute(o, 'vspace') testAttribute(o, 'width') o._set_align('left') rt = o._get_align() if rt != 'Left': error('get/set align failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableCellElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') c = doc.createElement('TD') print 'testing get/set' testAttribute(c, 'abbr') testAttribute(c, 'axis') testAttribute(c, 'bgColor') testAttribute(c, 'ch') testAttribute(c, 'chOff') testIntAttribute(c, 'colSpan') testAttribute(c, 'headers') testAttribute(c, 'height') testIntAttribute(c, 'noWrap') testIntAttribute(c, 'rowSpan') testAttribute(c, 'width') print 'get/set works' c._set_align('left') rt = c._get_align() if rt != 'Left': error('get/set align failed') c._set_vAlign('top') rt = c._get_vAlign() if rt != 'Top': error('get/set align failed') c._set_scope('colgroup') rt = c._get_scope() if rt != 'Colgroup': error('get/set align failed')
def test(): print 'testing source code syntax' from xml.dom.html.HTMLAppletElement import HTMLAppletElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') p = doc.createElement('Applet') print "testing get/set" testAttribute(p,'alt') testAttribute(p,'archive') testAttribute(p,'code') testAttribute(p,'codeBase') testAttribute(p,'height') testAttribute(p,'hspace') testAttribute(p,'object') testAttribute(p,'vspace') testAttribute(p,'width') p._set_align('left') rt = p._get_align() if rt != 'Left': error('get/set align failed') print "get/sets work"
def test(): print 'testing source code syntax' from xml.dom.html.HTMLAppletElement import HTMLAppletElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') p = doc.createElement('Applet') print "testing get/set" testAttribute(p, 'alt') testAttribute(p, 'archive') testAttribute(p, 'code') testAttribute(p, 'codeBase') testAttribute(p, 'height') testAttribute(p, 'hspace') testAttribute(p, 'object') testAttribute(p, 'vspace') testAttribute(p, 'width') p._set_align('left') rt = p._get_align() if rt != 'Left': error('get/set align failed') print "get/sets work"
def test(): print 'testing source code syntax' from xml.dom.html import HTMLBodyElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('Body') print 'testing get/set ' testAttribute(b, 'aLink') testAttribute(b, 'background') testAttribute(b, 'bgColor') testAttribute(b, 'link') testAttribute(b, 'text') testAttribute(b, 'vLink') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') t = doc.createElement('TABLE') print 'testing get/set' testAttribute(t, 'bgColor') testAttribute(t, 'border') testAttribute(t, 'cellPadding') testAttribute(t, 'cellSpacing') testAttribute(t, 'summary') testAttribute(t, 'width') t._set_align('left') rt = t._get_align() if rt != 'Left': error('get/set align failed') t._set_frame('border') rt = t._get_frame() if rt != 'Border': error('get/set frame failed') t._set_rules('all') rt = t._get_rules() if rt != 'All': error('get/set rules failed') print 'get/set works' print 'testing create and delete of THead' h = t.createTHead() h2 = t.createTHead() if t.childNodes.length != 1: error('create THead failed') if h.nodeName != h2.nodeName: error('create a second THead fails') t.deleteTHead() if t.childNodes.length != 0: error('deleteTHead fails') t.deleteTHead() print 'create and delete thead works' print 'testing create and delete TFoot' f = t.createTFoot() f2 = t.createTFoot() if t.childNodes.length != 1: error('create TFoot failed') if f.nodeName != f2.nodeName: error('create a second TFoot fails') t.deleteTFoot() if t.childNodes.length != 0: error('deleteTFoot fails') t.deleteTFoot() print 'create and delete of tfoot works' print 'testing create and delete of caption' c = t.createCaption() c2 = t.createCaption() if t.childNodes.length != 1: error('create Caption failed') if c.nodeName != c2.nodeName: error('second Create caption fails') t.deleteCaption() if t.childNodes.length != 0: error('delete of Caption failed') t.deleteCaption() print 'create and delete of caption works' print 'testing get Caption' c = t.createCaption() if t._get_caption().nodeName != c.nodeName: error('get caption failed') print 'getCaption works' print 'testing getTHead' h = t.createTHead() if t._get_tHead().nodeName != h.nodeName: error('get THead failed') print 'getTHead works' print 'testing getTFoot' f = t.createTFoot() if t._get_tFoot().nodeName != f.nodeName: error('get TFoot failed') print 'getTFoot works' print 'testing getRows,insertRow, and deleteRow' if t._get_rows().length != 0: error('getRows failed') r1 = t.insertRow(0) if t._get_rows().length != 1: error('getRows failed') if t._get_rows()[0].nodeName != r1.nodeName: error('insertRow Failed') try: r2 = t.insertRow(10) error('insertRows(10) does not throw exception') except: pass try: r3 = t.insertRow(-1) error('insertRows(-1) does not throw exception') except: pass r2 = t.insertRow(1) if t._get_rows().length != 2: error('insertRows(11) failed') t.deleteRow(0) if t._get_rows().length != 1: error('deleteRow failed') if t._get_rows()[0].nodeName != r2.nodeName: error('deleteRow failed') print 'insertRow, deleteRow, getRows works' print 'testing getTBodies' if t._get_tBodies().length != 1: error('getTBodies') print 'getTBodies works' print 'testing TR.getRowIndex' if r2._get_rowIndex() != 0: error('getRowIndex failed') print 'TR.getRowIndex works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableRowElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') r = doc.createElement('TR') #Row index and section row index tested in section print 'testing get/set' testAttribute(r, 'bgColor') testAttribute(r, 'ch') testAttribute(r, 'chOff') r._set_align('left') rt = r._get_align() if rt != 'Left': error('get/set align failed') r._set_vAlign('top') rt = r._get_vAlign() if rt != 'Top': error('get/set align failed') print 'get/set works' print 'testing insertCell,deleteCell, getCells, and TD.cellIndex' try: c1 = r.insertCell(-1) error('insertCell(-1) does not raise exception') except: pass c1 = r.insertCell(0) if c1 == None: error('insertCell(0) failed') try: c2 = r.insertCell(10) error('insertCell(10) does not raise exception') except: pass cells = r._get_cells() if cells._get_length() != 1: error('getCells failed') if cells.item(0).nodeName != c1.nodeName: error('getCells failed') try: r.deleteCell(-1) error('deleteCell(-1) does not raise exception') except: pass r.deleteCell(0) if c1._get_cellIndex() != -1: error('deleted cell still in tree') if r._get_cells().length != 0: error('deleteCell failed') print 'insertCell, deleteCell, getCells, and TD.getCellIndex works'
def test(): print 'Testing Syntax' from xml.dom.html.HTMLDocument import HTMLDocument from xml.dom import implementation d = implementation.createHTMLDocument('') print 'testing title' if d._get_title() != '': error('getTitle failed with no title') #This will test ADC d._set_title('TEST') if d._get_title() != 'TEST': error('get/set title failed with body') #Print test replace of a child d._set_title('TEST2') if d._get_title() != 'TEST2': error('replace a title failed') print 'title works' #d.removeChild(h); print 'testing documentElement' if d.documentElement == None: error('documentElement ADC failed') print 'documentElement works' print 'testing body' if d._get_body() == None: error('body ADC failed') b = d.createElement('BODY') d._set_body(b) if d._get_body().nodeName != b.nodeName: error('body failed on replace') print 'get/set Body works' print 'testing getImages' i = d.createElement('Img') b.appendChild(i) hc = d._get_images() if hc.length != 1: error('getImages failed') print 'getImages works' print 'getApplets' a = d.createElement('Applet') o = d.createElement('Object') o._set_code('TEST') hc = d._get_applets() if hc.length != 0: error('getApplets failed with none') b.appendChild(a) hc = d._get_applets() if hc.length != 1: error('getApplets failed for applets') b.appendChild(o) hc = d._get_applets() if hc.length != 2: error('getApplets failed for object') print 'getApplets works' print 'testing getLinks' a1 = d.createElement('Area') a1._set_href('TEST') a2 = d.createElement('A') a2._set_href('TEST') if d._get_links().length != 0: error('getLinks failed with no Links') b.appendChild(a1) if d._get_links().length != 1: error('getLinks failed with Area') b.appendChild(a2) if d._get_links().length != 2: error('getLinks failed with Anchor') print 'getLinks works' print 'testing getForms' if d._get_forms().length != 0: error('getForms failed with no Forms') f = d.createElement('FORM') b.appendChild(f) if d._get_forms().length != 1: error('getForms failed with a form') print 'getForms works' print 'testing getAnchors' if d._get_anchors().length != 0: error('get Anchors failed with none in there') a2._set_name('TEST') if d._get_anchors().length != 1: error('getAnchors failed with an Anchor') print 'getAnchors works' testAttribute(d, 'cookie') if CLONE_TEST_ENABLED: print 'test cloneNode (deep)' d2 = d.cloneNode(1) if d2._get_referrer() != d._get_referrer(): error('cloneNode did not set referrer') if d2._get_domain() != d._get_domain(): error('cloneNode did not set Domain') if d2._get_URL() != d._get_URL(): error('cloneNode did not set URL') if d2._get_cookie() != d._get_cookie(): error('cloneNode did not set cookie') else: print "NOTE: DOCUMENT CLONE TEST SKIPPED" print 'cloneNode works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLImageElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') i = doc.createElement('IMG') print 'testing get/set' testAttribute(i,'lowSrc') testAttribute(i,'alt') testAttribute(i,'border') testAttribute(i,'height') testAttribute(i,'hspace') testIntAttribute(i,'isMap') testAttribute(i,'longDesc') testAttribute(i,'src') testAttribute(i,'useMap') testAttribute(i,'vspace') testAttribute(i,'width') i._set_align('left') rt = i._get_align() if rt != 'Left': error('get/set align failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLAnchorElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') a = doc.createElement('A') print 'testing get/set' testAttribute(a, 'accessKey') testAttribute(a, 'charset') testAttribute(a, 'coords') testAttribute(a, 'href') testAttribute(a, 'hreflang') testAttribute(a, 'rel') testAttribute(a, 'rev') testIntAttribute(a, 'tabIndex') testAttribute(a, 'target') testAttribute(a, 'type') a._set_shape('rect') rt = a._get_shape() if rt != 'Rect': error('get/set shape failed') print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLInputElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') f = doc.createElement('Form') text = doc.createElement('Input') text.setAttribute('TYPE','TEXT') radio = doc.createElement('Input') radio.setAttribute('TYPE','RADIO') image = doc.createElement('Input') image.setAttribute('TYPE','IMAGE') f.appendChild(text) f.appendChild(radio) f.appendChild(image) print 'testing generic get/set functions' testAttribute(text,'defaultValue') testAttribute(text,'accept') testAttribute(text,'accessKey') testAttribute(text,'alt') testAttribute(text,'name') testAttribute(text,'size') testAttribute(image,'src') testAttribute(text,'useMap') testAttribute(text,'value') text._set_align('left') rt = text._get_align() if rt != 'Left': error('get/set of align failed') if image._get_type() != 'Image': error('get of type failed') print 'get/set works' print 'testing int Attributes' testIntAttribute(radio,'defaultChecked'); testIntAttribute(radio,'checked'); testIntAttribute(radio,'disabled'); testIntAttribute(text,'maxLength'); testIntAttribute(text,'readOnly'); testIntAttribute(text,'tabIndex'); print 'Int get/sets work' print "testing cloneNode" i2 = radio.cloneNode(0); if i2._get_defaultChecked() != radio._get_defaultChecked(): error('cloneNode failed to copy defaultChecked') i3 = text.cloneNode(0) if i3._get_defaultValue() != text._get_defaultValue(): error('cloneNode failed to copy defaultValue') print 'cloneNode works'
def test(): print "testing source code syntax" from xml.dom.html import HTMLTableSectionElement from xml.dom import implementation doc = implementation.createHTMLDocument("Title") s = doc.createElement("TFOOT") # Row index and section row index tested in section print "testing get/set" testAttribute(s, "ch") testAttribute(s, "chOff") s._set_align("left") rt = s._get_align() if rt != "Left": error("get/set align failed") s._set_vAlign("Top") rt = s._get_vAlign() if rt != "Top": error("get/set align failed") print "get/set works" print "testing insertRow,deleteRow, getRows, and TR.getRowSelectionIndex" try: r1 = s.insertRow(-1) error("insertRow(-1) does not raise exception") except: pass r1 = s.insertRow(0) if r1 == None: error("insertRow(0) failed") r2 = s.insertRow(1) if r2 == None: error("insertRow(1) failed") if r2._get_sectionRowIndex() != 1: error("getSectionRowIndex Failed") rows = s._get_rows() if rows._get_length() != 2: error("getRows failed") if rows.item(0).nodeName != r1.nodeName: error("getRows failed") if rows.item(1).nodeName != r2.nodeName: error("getRows failed") try: s.deleteRow(-1) error("deleteRow(-1) does not raise exception") except: pass s.deleteRow(1) if r2._get_rowIndex() != -1: error("deleted row still in tree") if s._get_rows()._get_length() != 1: error("deleteRow failed") s.deleteRow(0) if s._get_rows()._get_length() != 0: error("deleteRow(0) failed") print "insertRow, deleteRow, getRows, and TR.getSelectionRowIndex works"
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') t = doc.createElement('TABLE') print 'testing get/set' testAttribute(t,'bgColor'); testAttribute(t,'border'); testAttribute(t,'cellPadding'); testAttribute(t,'cellSpacing'); testAttribute(t,'summary'); testAttribute(t,'width'); t._set_align('left') rt = t._get_align() if rt != 'Left': error('get/set align failed') t._set_frame('border') rt = t._get_frame() if rt != 'Border': error('get/set frame failed') t._set_rules('all') rt = t._get_rules() if rt != 'All': error('get/set rules failed') print 'get/set works' print 'testing create and delete of THead' h = t.createTHead() h2 = t.createTHead() if t.childNodes.length != 1: error('create THead failed'); if h.nodeName != h2.nodeName: error('create a second THead fails'); t.deleteTHead() if t.childNodes.length != 0: error('deleteTHead fails') t.deleteTHead() print 'create and delete thead works' print 'testing create and delete TFoot' f = t.createTFoot() f2 = t.createTFoot() if t.childNodes.length != 1: error('create TFoot failed'); if f.nodeName != f2.nodeName: error('create a second TFoot fails'); t.deleteTFoot(); if t.childNodes.length != 0: error('deleteTFoot fails') t.deleteTFoot() print 'create and delete of tfoot works' print 'testing create and delete of caption' c = t.createCaption() c2 = t.createCaption() if t.childNodes.length != 1: error('create Caption failed'); if c.nodeName != c2.nodeName: error('second Create caption fails'); t.deleteCaption() if t.childNodes.length != 0: error('delete of Caption failed'); t.deleteCaption() print 'create and delete of caption works' print 'testing get Caption' c = t.createCaption() if t._get_caption().nodeName != c.nodeName: error('get caption failed'); print 'getCaption works' print 'testing getTHead' h = t.createTHead(); if t._get_tHead().nodeName != h.nodeName: error('get THead failed'); print 'getTHead works' print 'testing getTFoot' f = t.createTFoot(); if t._get_tFoot().nodeName != f.nodeName: error('get TFoot failed'); print 'getTFoot works' print 'testing getRows,insertRow, and deleteRow' if t._get_rows().length != 0: error('getRows failed'); r1 = t.insertRow(0); if t._get_rows().length != 1: error('getRows failed'); if t._get_rows()[0].nodeName != r1.nodeName: error('insertRow Failed') try: r2 = t.insertRow(10) error('insertRows(10) does not throw exception') except: pass try: r3 = t.insertRow(-1) error('insertRows(-1) does not throw exception') except: pass r2 = t.insertRow(1) if t._get_rows().length != 2: error('insertRows(11) failed'); t.deleteRow(0) if t._get_rows().length != 1: error('deleteRow failed'); if t._get_rows()[0].nodeName != r2.nodeName: error('deleteRow failed'); print 'insertRow, deleteRow, getRows works'; print 'testing getTBodies' if t._get_tBodies().length != 1: error('getTBodies'); print 'getTBodies works' print 'testing TR.getRowIndex' if r2._get_rowIndex() != 0: error('getRowIndex failed'); print 'TR.getRowIndex works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableRowElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') r = doc.createElement('TR') #Row index and section row index tested in section print 'testing get/set' testAttribute(r,'bgColor'); testAttribute(r,'ch'); testAttribute(r,'chOff'); r._set_align('left') rt = r._get_align() if rt != 'Left': error('get/set align failed') r._set_vAlign('top') rt = r._get_vAlign() if rt != 'Top': error('get/set align failed') print 'get/set works' print 'testing insertCell,deleteCell, getCells, and TD.cellIndex' try: c1 = r.insertCell(-1) error('insertCell(-1) does not raise exception') except: pass c1 = r.insertCell(0) if c1 == None: error('insertCell(0) failed'); try: c2 = r.insertCell(10) error('insertCell(10) does not raise exception') except: pass cells = r._get_cells() if cells._get_length() != 1: error('getCells failed'); if cells.item(0).nodeName != c1.nodeName: error('getCells failed'); try: r.deleteCell(-1); error('deleteCell(-1) does not raise exception'); except: pass r.deleteCell(0); if c1._get_cellIndex() != -1: error('deleted cell still in tree'); if r._get_cells().length != 0: error('deleteCell failed'); print 'insertCell, deleteCell, getCells, and TD.getCellIndex works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLSelectElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') s = doc.createElement('SELECT') o = doc.createElement('OPTION') o1 = doc.createElement('OPTION') print 'getType works' print 'testing get/set SelectedIndex' if s._get_selectedIndex() != -1: error('With none selected getSelectedIndex failed'); s.add(o,None) s.add(o1,o) s._set_selectedIndex(1) if s._get_selectedIndex() != 1: error('get/setSelected index fails when one is set'); print 'get/set selected index works' print 'testing getLength' if s._get_length() != 2: error('getLength fails'); print 'getLength works' print 'testing getOptions' os = s._get_options(); if os.item(0).nodeName != o1.nodeName: error('getOptions returns the wrong stuff') if os.item(1).nodeName != o.nodeName: error('getOptions does not return the correct stuff'); print 'getOptions works' print 'testing get/set disabled' if s._get_disabled() != 0: error('getDisabled failed when not set'); s._set_disabled(1) if s._get_disabled() != 1: error('get/set disabled failed when set'); s._set_disabled(0) if s._get_disabled() != 0: error('get/set disabled failed when not set'); print 'get/set disabled works' print 'testing get type' if s._get_type() != 'select-one': error('getType failed'); print 'testing get/set multiple' if s._get_multiple() != 0: error('getMultiple fails with nothing set'); s._set_multiple(1) if s._get_multiple() != 1: error('get/set multiple fails when set to 1'); s._set_multiple(0); if s._get_multiple() != 0: error('get/set multiple fails when set to 0'); print 'get/set multiple works' print 'test get/set name' testAttribute(s,'name'); print 'get/setName works' print 'testing get/set size' s._set_size(3) if s._get_size() != 3: error('get/setSize does not work'); print 'get/setSize works' print 'testing get/setTabIndex' s._set_tabIndex(3) if s._get_tabIndex() != 3: error('get/setTabIndex failed'); print 'get/setTabIndex works' print 'testing add' #This was already called if s.firstChild.nodeName != o1.nodeName: error('add does not work with 2 args'); if s.lastChild.nodeName != o.nodeName: error('add does not work with 1 arg'); print 'add works' print 'testing remove' s.remove(0); if s.firstChild.nodeName != o.nodeName: error('remove failed'); if s.lastChild.nodeName != o.nodeName: error('remove failed'); if s.firstChild._get_index() != 0: print s.firstChild.getIndex() error('reindex did not work on remove'); print 'remove works' print 'testing clone node' s1 = s.cloneNode(1); if s._get_selectedIndex() != s1._get_selectedIndex(): error('cloneNode did not copy Selected') print 'cloneNode Works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLBodyElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') b = doc.createElement('Body'); print 'testing get/set ' testAttribute(b,'aLink'); testAttribute(b,'background'); testAttribute(b,'bgColor'); testAttribute(b,'link'); testAttribute(b,'text'); testAttribute(b,'vLink'); print 'get/set works'
def test(): print 'testing source code syntax' from xml.dom.html import HTMLTableCellElement from xml.dom import implementation doc = implementation.createHTMLDocument('Title') c = doc.createElement('TD') print 'testing get/set' testAttribute(c,'abbr'); testAttribute(c,'axis'); testAttribute(c,'bgColor'); testAttribute(c,'ch'); testAttribute(c,'chOff'); testIntAttribute(c,'colSpan'); testAttribute(c,'headers'); testAttribute(c,'height'); testIntAttribute(c,'noWrap'); testIntAttribute(c,'rowSpan'); testAttribute(c,'width'); print 'get/set works' c._set_align('left') rt = c._get_align() if rt != 'Left': error('get/set align failed') c._set_vAlign('top') rt = c._get_vAlign() if rt != 'Top': error('get/set align failed') c._set_scope('colgroup') rt = c._get_scope() if rt != 'Colgroup': error('get/set align failed')
def test(): print 'Testing Syntax' from xml.dom.html.HTMLDocument import HTMLDocument from xml.dom import implementation d = implementation.createHTMLDocument('') print 'testing title' if d._get_title() != '': error('getTitle failed with no title'); #This will test ADC d._set_title('TEST'); if d._get_title() != 'TEST': error('get/set title failed with body') #Print test replace of a child d._set_title('TEST2'); if d._get_title() != 'TEST2': error('replace a title failed') print 'title works' #d.removeChild(h); print 'testing documentElement' if d.documentElement == None: error('documentElement ADC failed'); print 'documentElement works' print 'testing body' if d._get_body() == None: error('body ADC failed'); b = d.createElement('BODY'); d._set_body(b) if d._get_body().nodeName != b.nodeName: error('body failed on replace'); print 'get/set Body works' print 'testing getImages' i = d.createElement('Img'); b.appendChild(i); hc = d._get_images() if hc.length != 1: error('getImages failed'); print 'getImages works' print 'getApplets' a = d.createElement('Applet'); o = d.createElement('Object'); o._set_code('TEST'); hc = d._get_applets() if hc.length != 0: error('getApplets failed with none'); b.appendChild(a); hc = d._get_applets(); if hc.length != 1: error('getApplets failed for applets'); b.appendChild(o) hc = d._get_applets() if hc.length != 2: error('getApplets failed for object'); print 'getApplets works' print 'testing getLinks' a1 = d.createElement('Area'); a1._set_href('TEST') a2 = d.createElement('A'); a2._set_href('TEST') if d._get_links().length != 0: error('getLinks failed with no Links'); b.appendChild(a1); if d._get_links().length != 1: error('getLinks failed with Area'); b.appendChild(a2); if d._get_links().length != 2: error('getLinks failed with Anchor'); print 'getLinks works' print 'testing getForms'; if d._get_forms().length != 0: error('getForms failed with no Forms'); f = d.createElement('FORM'); b.appendChild(f); if d._get_forms().length != 1: error('getForms failed with a form'); print 'getForms works' print 'testing getAnchors' if d._get_anchors().length != 0: error('get Anchors failed with none in there'); a2._set_name('TEST'); if d._get_anchors().length != 1: error('getAnchors failed with an Anchor'); print 'getAnchors works' testAttribute(d,'cookie'); if CLONE_TEST_ENABLED: print 'test cloneNode (deep)' d2 = d.cloneNode(1) if d2._get_referrer() != d._get_referrer(): error('cloneNode did not set referrer'); if d2._get_domain() != d._get_domain(): error('cloneNode did not set Domain'); if d2._get_URL() != d._get_URL(): error('cloneNode did not set URL'); if d2._get_cookie() != d._get_cookie(): error('cloneNode did not set cookie'); else: print "NOTE: DOCUMENT CLONE TEST SKIPPED" print 'cloneNode works'