remove tests with too many votes

This commit is contained in:
Martin Zimmermann 2014-06-25 19:07:19 +02:00
parent 5f71b735e5
commit b2bc582f92
2 changed files with 2 additions and 14 deletions

View File

@ -75,18 +75,6 @@ class TestVote(unittest.TestCase):
self.assertEqual(rv.status_code, 200)
self.assertEqual(loads(rv.data), None)
def testTooManyLikes(self):
self.makeClient("127.0.0.1").post("/new?uri=test", data=json.dumps({"text": "..."}))
for num in range(256):
rv = self.makeClient("1.2.%i.0" % num).post('/id/1/like')
self.assertEqual(rv.status_code, 200)
if num >= 142:
self.assertEqual(loads(rv.data)["likes"], 142)
else:
self.assertEqual(loads(rv.data)["likes"], num + 1)
def testDislike(self):
self.makeClient("127.0.0.1").post("/new?uri=test", data=json.dumps({"text": "..."}))
rv = self.makeClient("1.2.3.4").post('/id/1/dislike')

View File

@ -33,7 +33,7 @@ def anonymize(remote_addr):
return u'' + ipv6.exploded.rsplit(':', 5)[0] + ':' + ':'.join(['0000']*5)
class Bloomfilter:
class Bloomfilter(object):
"""A space-efficient probabilistic data structure. False-positive rate:
* 1e-05 for <80 elements
@ -46,7 +46,7 @@ class Bloomfilter:
>>> bf = Bloomfilter()
>>> bf.add("127.0.0.1")
>>> not any(map(bf.__contains__, ("1.2.%i.4" for i in range(256))))
>>> not any(addr in bf for addr in ("1.2.%i.4" for i in range(256)))
True
>>> bf = Bloomfilter()