def test_thonky_add_format_info(): # <http://www.thonky.com/qr-code-tutorial/format-version-information#put-the-format-string-into-the-qr-code> version = 1 matrix = encoder.make_matrix(version, reserve_regions=False) encoder.add_finder_patterns(matrix, is_micro=False) encoder.add_format_info(matrix, version, consts.ERROR_LEVEL_L, 4) ref_matrix = read_matrix('thonky_format') assert ref_matrix == matrix
def test_format_info_figure26(): # 7.9.2 Micro QR Code symbols (page 57) version = consts.VERSION_M1 mask = 3 matrix = tuple([bytearray([0x0] * 11) for i in range(11)]) encoder.add_timing_pattern(matrix, is_micro=True) encoder.add_finder_patterns(matrix, is_micro=True) encoder.add_format_info(matrix, version=version, error=None, mask_pattern=mask) ref_matrix = read_matrix('fig-26') assert len(ref_matrix) == len(matrix) assert ref_matrix == matrix