Reverse before limit
This commit is contained in:
parent
9b0bce93dc
commit
33f31652ea
2 changed files with 28 additions and 4 deletions
|
|
@ -570,6 +570,30 @@ def test_query_with_global_indexes():
|
|||
list(results).should.have.length_of(0)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
def test_reverse_query():
|
||||
conn = boto.dynamodb2.layer1.DynamoDBConnection()
|
||||
|
||||
table = Table.create('messages', schema=[
|
||||
HashKey('subject'),
|
||||
RangeKey('created_at', data_type='N')
|
||||
])
|
||||
|
||||
for i in range(10):
|
||||
table.put_item({
|
||||
'subject': "Hi",
|
||||
'created_at': i
|
||||
})
|
||||
|
||||
results = table.query_2(subject__eq="Hi",
|
||||
created_at__lt=6,
|
||||
limit=4,
|
||||
reverse=True)
|
||||
|
||||
expected = map(Decimal, [5, 4, 3, 2])
|
||||
[r['created_at'] for r in results].should.equal(expected)
|
||||
|
||||
|
||||
@mock_dynamodb2
|
||||
def test_lookup():
|
||||
from decimal import Decimal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue