diff --git a/CHANGELOG.md b/CHANGELOG.md index 26b2492..f44679f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/rapidfuzz/distance/_initialize_cpp.pyx b/src/rapidfuzz/distance/_initialize_cpp.pyx index 5987295..69ac617 100644 --- a/src/rapidfuzz/distance/_initialize_cpp.pyx +++ b/src/rapidfuzz/distance/_initialize_cpp.pyx @@ -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 += self.editops.size() - - if index < 0 or index >= 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 += self.opcodes.size() - - if index < 0 or index >= 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 diff --git a/tests/distance/test_init.py b/tests/distance/test_init.py index 9fbaf22..b074a44 100644 --- a/tests/distance/test_init.py +++ b/tests/distance/test_init.py @@ -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()