Ejemplo n.º 1
0
 def test_minv_maxv_limit(self):
     minv = 1465289825265391
     maxv = 1465894624580543
     got = sorted(longkeysortreverse(self.treeset, minv, maxv, 10))
     expect = [x for x in replay_ids if minv <= x <= maxv][-10:]
     self.assertEquals(len(got), len(expect))
     self.assertEquals(got, expect)
Ejemplo n.º 2
0
 def test_min_day_max_hour_limit(self):
     maxv = long((time.time() - 3600) * 1e6)
     minv = long((time.time() - 3600 * 24) * 1e6)
     values = list(
         longkeysortreverse(self.treeset, minv=minv, maxv=maxv, limit=1))
     expect = [self.k3]
     self.assertEquals(values, expect)
Ejemplo n.º 3
0
 def test_min_day_max_hour(self):
     maxv = long((time.time() - 3600) * 1e6)
     minv = long((time.time() - 3600 * 24) * 1e6)
     values = list(longkeysortreverse(self.treeset,
                                      minv=minv,
                                      maxv=maxv))
     expect = [self.k3, self.k2, self.k1]
     self.assertEquals(values, expect)
Ejemplo n.º 4
0
 def test_longkeysortreverse(self):
     """Admin access should not be impacted by longkeysortreverse"""
     self.assertIn('Manager', api.user.get_roles())
     got = sorted([
         x for x in longkeysortreverse(self.tool._status_mapping.keys(),
                                       None, None, None)
     ])
     self.assertEquals(len(got), len(self.allkeys))
     self.assertEquals(got, self.allkeys)
Ejemplo n.º 5
0
 def test_all_limit(self):
     values = list(longkeysortreverse(self.treeset, limit=3))
     expect = [self.k11, self.k10, self.k3]
     self.assertEquals(values, expect)
Ejemplo n.º 6
0
 def test_minv_limit(self):
     minv = 1465289825265391
     got = sorted(longkeysortreverse(self.treeset, minv, None, 20))
     expect = [x for x in replay_ids if minv <= x][-20:]
     self.assertEquals(len(got), len(expect))
     self.assertEquals(got, expect)
Ejemplo n.º 7
0
 def test_min_day(self):
     minv = long((time.time() - 3600 * 24) * 1e6)
     values = list(longkeysortreverse(self.treeset, minv=minv))
     expect = [self.k11, self.k10, self.k3, self.k2]
     self.assertEquals(values, expect)
Ejemplo n.º 8
0
 def test_max_day_optimize(self):
     maxv = long((time.time() - 3600 * 24) * 1e6)
     values = list(longkeysortreverse(self.treeset, maxv=maxv, limit=100))
     expect = [self.k1, self.k0]
     self.assertEquals(values, expect)
Ejemplo n.º 9
0
 def test_all(self):
     values = list(longkeysortreverse(self.treeset))
     expect = [self.k11, self.k10, self.k3, self.k2, self.k1, self.k0]
     self.assertEquals(values, expect)
Ejemplo n.º 10
0
 def test_max_hour2_direct(self):
     maxv = long((time.time() - 3600 * 2) * 1e6)
     values = list(longkeysortreverse(self.treeset, maxv=maxv))
     expect = [self.k3, self.k2, self.k1, self.k0]
     self.assertEquals(values, expect)
Ejemplo n.º 11
0
 def test_maxv_limit(self):
     maxv = 1465894624580543
     got = sorted(longkeysortreverse(self.treeset, None, maxv, 20))
     expect = [x for x in replay_ids if x <= maxv][-20:]
     self.assertEquals(len(got), len(expect))
     self.assertEquals(got, expect)
Ejemplo n.º 12
0
 def test_min_hour(self):
     minv = long((time.time() - 3600) * 1e6)
     values = list(longkeysortreverse(self.treeset, minv=minv))
     expect = [self.k11, self.k10]
     self.assertEquals(values, expect)
Ejemplo n.º 13
0
 def test_all(self):
     values = list(longkeysortreverse(self.treeset))
     expect = [self.k11, self.k10, self.k3, self.k2, self.k1, self.k0]
     self.assertEquals(values, expect)
Ejemplo n.º 14
0
 def test_limit_50(self):
     got = sorted(longkeysortreverse(self.treeset, None, None, 50))
     expect = replay_ids[-50:]
     self.assertEquals(len(got), len(expect))
     self.assertEquals(got, expect)
Ejemplo n.º 15
0
 def test_all2(self):
     got = sorted(longkeysortreverse(self.treeset, None, None, None))
     expect = replay_ids
     self.assertEquals(len(got), len(expect))
     self.assertEquals(got, expect)
Ejemplo n.º 16
0
 def test_all_limit(self):
     values = list(longkeysortreverse(self.treeset, limit=3))
     expect = [self.k11, self.k10, self.k3]
     self.assertEquals(values, expect)
Ejemplo n.º 17
0
 def test_max_day(self):
     maxv = long((time.time() - 3600 * 24) * 1e6)
     values = list(longkeysortreverse(self.treeset, maxv=maxv))
     expect = [self.k0]
     self.assertEquals(values, expect)