mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 07:47:14 +03:00
use range instead of silly checks
This commit is contained in:
parent
3133cba0a4
commit
532716e748
@ -83,7 +83,7 @@ def _apply(target: UPDATABLE_DATA, key: str, to_set: Any = None, delete: bool =
|
||||
|
||||
if delete and len(target) > 0:
|
||||
length = len(target)
|
||||
if (idx > 0 and length > idx) or idx >= -length:
|
||||
if idx in range(-length, length):
|
||||
target.pop(idx)
|
||||
|
||||
elif len(target) == idx:
|
||||
|
@ -19,6 +19,7 @@ from killswitch import UPDATABLE_DATA
|
||||
(['test neg del'], '-1', 'delete', None, []),
|
||||
(['test neg del'], '-1337', 'delete', None, ['test neg del']),
|
||||
(['test neg del'], '-2', 'delete', None, ['test neg del']),
|
||||
(['test too high del'], '30', 'delete', None, ['test too high del']),
|
||||
]
|
||||
)
|
||||
def test_apply(source: UPDATABLE_DATA, key: str, action: str, to_set: Any, result: UPDATABLE_DATA) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user