From 0fa7ce11273bf4f449d2e486ab95dba0f5a354be Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Fri, 3 Aug 2018 14:05:42 +0100 Subject: [PATCH] Remove unused beos2bsp, and add a test assertion comparing leos2ip with lebs2ip o leos2bsp. Signed-off-by: Daira Hopwood --- sapling_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sapling_utils.py b/sapling_utils.py index ed9dcdb..a334134 100644 --- a/sapling_utils.py +++ b/sapling_utils.py @@ -49,15 +49,14 @@ def bebs2osp(bits, m=None): bits = [0] * (8 * cldiv(l, 8) - l) + bits return bytes([bebs2ip(bits[i:i + 8]) for i in range(0, len(bits), 8)]) -def beos2bsp(buf): - return sum([[(c >> (7-i)) & 1 for i in range(8)] for c in buf], []) - assert i2leosp(5, 7) == lebs2osp(i2lebsp(5, 7)) assert i2leosp(32, 1234567890) == lebs2osp(i2lebsp(32, 1234567890)) assert i2beosp(5, 7) == bebs2osp(i2bebsp(5, 7)) assert i2beosp(32, 1234567890) == bebs2osp(i2bebsp(32, 1234567890)) +assert leos2ip(bytes(range(256))) == lebs2ip(leos2bsp(bytes(range(256)))) + assert bebs2ip(i2bebsp(5, 7)) == 7 try: i2bebsp(3, 12)