Beispiel #1
0
 def history_last(cls):
     items = cls.history.filter(StrInt.n_max(),
                                StrInt.n_min(),
                                max_results=1)
     if not items:
         return None
     return cls.get(items[0])
Beispiel #2
0
 def history_last(cls):
     items = cls.history.filter(StrInt.n_max(),
                                StrInt.n_min(),
                                max_results=1)
     if not items:
         return None
     return cls.get(items[0])
Beispiel #3
0
def test_reversed_order_is_preserved():
    added = []
    for i in range(4):
        li = LogItem.new({'log': 'history'})
        li.save()
        added.append(li.key)
    added.reverse()
    assert list(
        LogItem.history.filter(StrInt.n_max(), StrInt.n_min(),
                               max_results=2)) == added[:2]
Beispiel #4
0
def test_reversed_order_is_preserved():
    added = []
    for i in range(4):
        li = HistoryItem.new(str(i), {})
        li.save()
        added.append(li.key)
    added.reverse()
    assert list(HistoryItem.history.filter(StrInt.n_max(),
                                           StrInt.n_min(),
                                           max_results=2)) == added[:2]
Beispiel #5
0
def test_staged_not_indexed():
    added = []
    for i in range(3):
        li = LogItem.new({'log': 'staged'})
        li.save()
        added.append(li)

    for li in added[:2]:
        li.log = 'history'
        li.save()

    assert set(LogItem.history.filter(
        StrInt.n_max(), StrInt.n_min())) == {li.key
                                             for li in added[:2]}