def test_readonlylist(self): # Assert read-only list. v = vector.readonlylist([1,2]) self.assertTrue(isinstance(v, list)) self.assertRaises(vector.ReadOnlyError, v.__setitem__, 0, 0) self.assertRaises(vector.ReadOnlyError, v.__delitem__, 0) self.assertRaises(vector.ReadOnlyError, v.append, 3) self.assertRaises(vector.ReadOnlyError, v.insert, 2, 3) self.assertRaises(vector.ReadOnlyError, v.extend, [3, 4]) self.assertRaises(vector.ReadOnlyError, v.remove, 1) self.assertRaises(vector.ReadOnlyError, v.pop, 0) print("pattern.vector.readonlylist")
def test_readonlylist(self): # Assert read-only list. v = vector.readonlylist([1, 2]) self.assertTrue(isinstance(v, list)) self.assertRaises(vector.ReadOnlyError, v.__setitem__, 0, 0) self.assertRaises(vector.ReadOnlyError, v.__delitem__, 0) self.assertRaises(vector.ReadOnlyError, v.append, 3) self.assertRaises(vector.ReadOnlyError, v.insert, 2, 3) self.assertRaises(vector.ReadOnlyError, v.extend, [3, 4]) self.assertRaises(vector.ReadOnlyError, v.remove, 1) self.assertRaises(vector.ReadOnlyError, v.pop, 0) print "pattern.vector.readonlylist"