From 5df16f11eb536f76b74d468de33114f25c2c9ac1 Mon Sep 17 00:00:00 2001 From: Tiela Rose Black-Law <26930264+tielarose@users.noreply.github.com> Date: Fri, 27 Oct 2023 14:13:51 -0700 Subject: [PATCH] Add doctest to hashes/hamming_code.py (#10961) --- hashes/hamming_code.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hashes/hamming_code.py b/hashes/hamming_code.py index 8498ca920..4a6efcf23 100644 --- a/hashes/hamming_code.py +++ b/hashes/hamming_code.py @@ -77,6 +77,10 @@ def emitter_converter(size_par, data): >>> emitter_converter(4, "101010111111") ['1', '1', '1', '1', '0', '1', '0', '0', '1', '0', '1', '1', '1', '1', '1', '1'] + >>> emitter_converter(5, "101010111111") + Traceback (most recent call last): + ... + ValueError: size of parity don't match with size of data """ if size_par + len(data) <= 2**size_par - (len(data) - 1): raise ValueError("size of parity don't match with size of data")