tests/basics: Add tests to improve coverage of py/objdeque.c.

This commit is contained in:
Damien George 2018-02-21 23:19:06 +11:00
parent 4668ec801e
commit 8f9b113be2
2 changed files with 22 additions and 0 deletions

View File

@ -45,3 +45,18 @@ try:
d.popleft()
except IndexError:
print("IndexError")
# Case where get index wraps around when appending to full deque
d = deque((), 2)
d.append(1)
d.append(2)
d.append(3)
d.append(4)
d.append(5)
print(d.popleft(), d.popleft())
# Unsupported unary op
try:
~d
except TypeError:
print("TypeError")

View File

@ -13,3 +13,10 @@ print(sys.getsizeof({1: 2}) >= 2)
class A:
pass
print(sys.getsizeof(A()) > 0)
# Only test deque if we have it
try:
from ucollections import deque
assert sys.getsizeof(deque((), 1)) > 0
except ImportError:
pass