def test_setslice_partial_wrong_length(self):
Element = self.Element
root = Element("root")
l = ["c1", "c2", "c3", "c4"]
root.c = l
self.assertEqual(["c1", "c2", "c3", "c4"],
[ c.text for c in root.c ])
self.assertEqual(l,
[ c.text for c in root.c ])
new_slice = ["cA", "cB", "cC"]
self.assertRaises(
ValueError, operator.setitem,
l, slice(1,2,-1), new_slice)
self.assertRaises(
ValueError, operator.setitem,
root.c, slice(1,2,-1), new_slice)
评论列表
文章目录