1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
def test(tester):
tester.startGroup('Notation')
tester.startTest('Testing syntax')
try:
from xml.dom import Notation
from xml.dom.Notation import Notation
except:
tester.error('Error in syntax', 1)
tester.testDone()
tester.startTest('Creating test environment')
from xml.dom import implementation
dt = implementation.createDocumentType('','','')
doc = implementation.createDocument('','ROOT',dt)
nota = doc._4dom_createNotation("-//FOURTHOUGHT//EN", "/tmp/notation", "TestNotation")
tester.testDone()
tester.startTest('Testing attributes')
if nota.publicId != '-//FOURTHOUGHT//EN':
tester.error('publicId is incorrect')
if nota.systemId != '/tmp/notation':
tester.error('systemId is incorrect')
tester.testDone()
tester.startTest('Test cloneNode()')
nota1 = nota.cloneNode(1)
if nota1.publicId != nota.publicId:
tester.error("cloneNode fails on publicId")
if nota1.systemId != nota.systemId:
tester.error("cloneNode fails on systemId")
tester.testDone()
return tester.groupDone()
if __name__ == '__main__':
import sys
import TestSuite
tester = TestSuite.TestSuite()
retVal = test(tester)
sys.exit(retVal)
|