delitem would need revalidation so remove it for now
This commit is contained in:
parent
779e896d39
commit
9a6574320e
|
@ -2,7 +2,6 @@
|
|||
|
||||
### [2.3.0] - 2022-07-
|
||||
#### Added
|
||||
- add support for deletions from `Editops`/`Opcodes`
|
||||
- add `as_matching_blocks` to `Editops`/`Opcodes`
|
||||
|
||||
#### Changed
|
||||
|
|
|
@ -446,16 +446,6 @@ cdef class Editops:
|
|||
def __len__(self):
|
||||
return self.editops.size()
|
||||
|
||||
def __delitem__(self, item):
|
||||
cdef Py_ssize_t index = item
|
||||
if index < 0:
|
||||
index += <Py_ssize_t>self.editops.size()
|
||||
|
||||
if index < 0 or index >= <Py_ssize_t>self.editops.size():
|
||||
raise IndexError("Editops index out of range")
|
||||
|
||||
self.editops.erase(self.editops.begin() + index)
|
||||
|
||||
def __getitem__(self, key):
|
||||
cdef Py_ssize_t index
|
||||
|
||||
|
@ -670,16 +660,6 @@ cdef class Opcodes:
|
|||
def __len__(self):
|
||||
return self.opcodes.size()
|
||||
|
||||
def __delitem__(self, item):
|
||||
cdef Py_ssize_t index = item
|
||||
if index < 0:
|
||||
index += <Py_ssize_t>self.opcodes.size()
|
||||
|
||||
if index < 0 or index >= <Py_ssize_t>self.opcodes.size():
|
||||
raise IndexError("Opcodes index out of range")
|
||||
|
||||
self.opcodes.erase(self.opcodes.begin() + index)
|
||||
|
||||
def __getitem__(self, key):
|
||||
cdef Py_ssize_t index
|
||||
|
||||
|
|
|
@ -206,23 +206,5 @@ def test_merge_adjacent_blocks():
|
|||
assert Opcodes(ops1, 3, 3) == Opcodes(ops2, 3, 3)
|
||||
assert Opcodes(ops2, 3, 3) == Opcodes(ops2, 3, 3).as_editops().as_opcodes()
|
||||
|
||||
|
||||
def test_deletions():
|
||||
"""
|
||||
test whether deletions from Editops / Opcodes are possible
|
||||
"""
|
||||
ops = [
|
||||
Opcode(tag="equal", src_start=0, src_end=1, dest_start=0, dest_end=1),
|
||||
Opcode(tag="replace", src_start=1, src_end=3, dest_start=1, dest_end=3),
|
||||
]
|
||||
opcodes = Opcodes(ops, 3, 3)
|
||||
del opcodes[0]
|
||||
assert opcodes[0] == ops[1]
|
||||
|
||||
editops = Editops(ops, 3, 3)
|
||||
editop = editops[1]
|
||||
del editops[0]
|
||||
assert editops[0] == editop
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue