Skip to content

Commit 21b4f5b

Browse files
Revert "Warn when slicing twice (#1775)" (#1814)
This reverts commit b9c8343.
1 parent a5880ef commit 21b4f5b

File tree

3 files changed

+2
-24
lines changed

3 files changed

+2
-24
lines changed

elasticsearch_dsl/search_base.py

-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import collections.abc
1919
import copy
20-
import warnings
2120

2221
from .aggs import A, AggBase
2322
from .exceptions import IllegalOperation
@@ -349,15 +348,6 @@ def __getitem__(self, n):
349348
"""
350349
s = self._clone()
351350

352-
if "from" in s._extra or "size" in s._extra:
353-
warnings.warn(
354-
"Slicing multiple times currently has no effect but will be supported "
355-
"in a future release. See https://github.com/elastic/elasticsearch-dsl-py/pull/1771 "
356-
"for more details",
357-
DeprecationWarning,
358-
stacklevel=2,
359-
)
360-
361351
if isinstance(n, slice):
362352
# If negative slicing, abort.
363353
if n.start and n.start < 0 or n.stop and n.stop < 0:

tests/_async/test_search.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from copy import deepcopy
1919

2020
import pytest
21-
from pytest import raises, warns
21+
from pytest import raises
2222

2323
from elasticsearch_dsl import A, AsyncEmptySearch, AsyncSearch, Document, Q, query
2424
from elasticsearch_dsl.exceptions import IllegalOperation
@@ -369,12 +369,6 @@ def test_slice():
369369
assert {"from": 20, "size": 0} == s[20:0].to_dict()
370370

371371

372-
def test_slice_twice():
373-
with warns(DeprecationWarning, match="Slicing multiple times .*"):
374-
s = AsyncSearch()
375-
s[10:20][2:]
376-
377-
378372
def test_index():
379373
s = AsyncSearch()
380374
assert {"from": 3, "size": 1} == s[3].to_dict()

tests/_sync/test_search.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from copy import deepcopy
1919

2020
import pytest
21-
from pytest import raises, warns
21+
from pytest import raises
2222

2323
from elasticsearch_dsl import A, Document, EmptySearch, Q, Search, query
2424
from elasticsearch_dsl.exceptions import IllegalOperation
@@ -369,12 +369,6 @@ def test_slice():
369369
assert {"from": 20, "size": 0} == s[20:0].to_dict()
370370

371371

372-
def test_slice_twice():
373-
with warns(DeprecationWarning, match="Slicing multiple times .*"):
374-
s = Search()
375-
s[10:20][2:]
376-
377-
378372
def test_index():
379373
s = Search()
380374
assert {"from": 3, "size": 1} == s[3].to_dict()

0 commit comments

Comments
 (0)