(self)
| 1141 | doc.unlink() |
| 1142 | |
| 1143 | def testNormalizeRecursion(self): |
| 1144 | doc = parseString("<doc>" |
| 1145 | "<o>" |
| 1146 | "<i/>" |
| 1147 | "t" |
| 1148 | # |
| 1149 | #x |
| 1150 | "</o>" |
| 1151 | "<o>" |
| 1152 | "<o>" |
| 1153 | "t2" |
| 1154 | #x2 |
| 1155 | "</o>" |
| 1156 | "t3" |
| 1157 | #x3 |
| 1158 | "</o>" |
| 1159 | # |
| 1160 | "</doc>") |
| 1161 | root = doc.documentElement |
| 1162 | root.childNodes[0].appendChild(doc.createTextNode("")) |
| 1163 | root.childNodes[0].appendChild(doc.createTextNode("x")) |
| 1164 | root.childNodes[1].childNodes[0].appendChild(doc.createTextNode("x2")) |
| 1165 | root.childNodes[1].appendChild(doc.createTextNode("x3")) |
| 1166 | root.appendChild(doc.createTextNode("")) |
| 1167 | self.confirm(len(root.childNodes) == 3 |
| 1168 | and root.childNodes.length == 3 |
| 1169 | and len(root.childNodes[0].childNodes) == 4 |
| 1170 | and root.childNodes[0].childNodes.length == 4 |
| 1171 | and len(root.childNodes[1].childNodes) == 3 |
| 1172 | and root.childNodes[1].childNodes.length == 3 |
| 1173 | and len(root.childNodes[1].childNodes[0].childNodes) == 2 |
| 1174 | and root.childNodes[1].childNodes[0].childNodes.length == 2 |
| 1175 | , "testNormalize2 -- preparation") |
| 1176 | doc.normalize() |
| 1177 | self.confirm(len(root.childNodes) == 2 |
| 1178 | and root.childNodes.length == 2 |
| 1179 | and len(root.childNodes[0].childNodes) == 2 |
| 1180 | and root.childNodes[0].childNodes.length == 2 |
| 1181 | and len(root.childNodes[1].childNodes) == 2 |
| 1182 | and root.childNodes[1].childNodes.length == 2 |
| 1183 | and len(root.childNodes[1].childNodes[0].childNodes) == 1 |
| 1184 | and root.childNodes[1].childNodes[0].childNodes.length == 1 |
| 1185 | , "testNormalize2 -- childNodes lengths") |
| 1186 | self.confirm(root.childNodes[0].childNodes[1].data == "tx" |
| 1187 | and root.childNodes[1].childNodes[0].childNodes[0].data == "t2x2" |
| 1188 | and root.childNodes[1].childNodes[1].data == "t3x3" |
| 1189 | , "testNormalize2 -- joined text fields") |
| 1190 | self.confirm(root.childNodes[0].childNodes[1].nextSibling is None |
| 1191 | and root.childNodes[0].childNodes[1].previousSibling |
| 1192 | is root.childNodes[0].childNodes[0] |
| 1193 | and root.childNodes[0].childNodes[0].previousSibling is None |
| 1194 | and root.childNodes[0].childNodes[0].nextSibling |
| 1195 | is root.childNodes[0].childNodes[1] |
| 1196 | and root.childNodes[1].childNodes[1].nextSibling is None |
| 1197 | and root.childNodes[1].childNodes[1].previousSibling |
| 1198 | is root.childNodes[1].childNodes[0] |
| 1199 | and root.childNodes[1].childNodes[0].previousSibling is None |
| 1200 | and root.childNodes[1].childNodes[0].nextSibling |
nothing calls this directly
no test coverage detected