From e8558f6f9fd6b20364e904151ec149df4f5d0999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Boczar?= Date: Fri, 20 Mar 2020 13:18:24 +0100 Subject: [PATCH] test: fix bits formatting --- test/test_ecc.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test_ecc.py b/test/test_ecc.py index 24d96e3..5b5bcef 100644 --- a/test/test_ecc.py +++ b/test/test_ecc.py @@ -25,10 +25,12 @@ def frombits(bits): return int(bits[::-1], 2) def bits_pp(value, width=32): - # pretty print binary value, with 0b, groupped by nibbles + # pretty print binary value, groupped by bytes if isinstance(value, str): value = frombits(value) - return f"{value:#0{width}_b}" + s = f"{value:0{width}b}" + byte_chunks = [s[i:i+8] for i in range(0, len(s), 8)] + return "0b " + " ".join(byte_chunks) def extract_ecc_data(data_width, codeword_width, codeword_bits):