one more
This commit is contained in:
@@ -54,3 +54,7 @@ class BucketChooserProportionalLogRandom:
|
||||
1 + int(100 * math.log2(i[1])),
|
||||
) for i in content
|
||||
]
|
||||
|
||||
class BucketChooserProportionalRandom(BucketChooserProportionalLogRandom):
|
||||
def xform(self, content):
|
||||
return [(i[0], 1+int(100*i[1])) for i in content]
|
||||
|
||||
@@ -34,6 +34,7 @@ class TestBucketChoosers(unittest.TestCase):
|
||||
def test_choosers(self):
|
||||
for chooser in [
|
||||
bucket.BucketChooserProportionalLogRandom(),
|
||||
bucket.BucketChooserProportionalRandom(),
|
||||
]:
|
||||
with self.assertRaises(AssertionError):
|
||||
self.assertRaises(chooser.choose([]))
|
||||
|
||||
Reference in New Issue
Block a user