8000 add lower bound tests for memoryviews · wumingcp-ps/msgpack-python@a91d5c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit a91d5c5

Browse files
committed
add lower bound tests for memoryviews
1 parent 5860af9 commit a91d5c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/test_memoryview.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,23 @@ def __run_test(format, nbytes, expected_header, expected_prefix, use_bin_type):
5858

5959

6060
def test_fixstr_from_byte():
61+
__run_test('B', 1, b'\xa1', b'', False)
6162
__run_test('B', 31, b'\xbf', b'', False)
6263

6364

6465
def test_fixstr_from_float():
66+
__run_test('f', 4, b'\xa4', b'', False)
6567
__run_test('f', 28, b'\xbc', b'', False)
6668

6769

6870
def test_str16_from_byte():
6971
__run_test('B', 2**8, b'\xda', b'\x01\x00', False)
72+
__run_test('B', 2**16-1, b'\xda', b'\xff\xff', False)
7073

7174

7275
def test_str16_from_float():
7376
__run_test('f', 2**8, b'\xda', b'\x01\x00', False)
77+
__run_test('f', 2**16-4, b'\xda', b'\xff\xfc', False)
7478

7579

7680
def test_str32_from_byte():
@@ -83,18 +87,22 @@ def test_str32_from_float():
8387

8488
def test_bin8_from_byte():
8589
__run_test('B', 1, b'\xc4', b'\x01', True)
90+
__run_test('B', 2**8-1, b'\xc4', b'\xff', True)
8691

8792

8893
def test_bin8_from_float():
8994
__run_test('f', 4, b'\xc4', b'\x04', True)
95+
__run_test('f', 2**8-4, b'\xc4', b'\xfc', True)
9096

9197

9298
def test_bin16_from_byte():
9399
__run_test('B', 2**8, b'\xc5', b'\x01\x00', True)
100+
__run_test('B', 2**16-1, b'\xc5', b'\xff\xff', True)
94101

95102

96103
def test_bin16_from_float():
97104
__run_test('f', 2**8, b'\xc5', b'\x01\x00', True)
105+
__run_test('f', 2**16-4, b'\xc5', b'\xff\xfc', True)
98106

99107

100108
def test_bin32_from_byte():

0 commit comments

Comments
 (0)
0