FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
msgpack-python/test/test_format.py at master · overcastcloud/msgpack-python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
overcastcloud
/
msgpack-python
Public
forked from
msgpack/msgpack-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
msgpack-python
/
test
/
test_format.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
70 lines (58 loc) · 2.05 KB
Breadcrumbs
msgpack-python
/
test
/
test_format.py
Copy path
File metadata and controls
70 lines (58 loc) · 2.05 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# coding: utf-8
from
msgpack
import
unpackb
def
check
(
src
,
should
,
use_list
=
0
):
assert
unpackb
(
src
,
use_list
=
use_list
)
==
should
def
testSimpleValue
():
check
(
b"
\x93
\xc0
\xc2
\xc3
"
,
(
None
,
False
,
True
,))
def
testFixnum
():
check
(
b"
\x92
\x93
\x00
\x40
\x7f
\x93
\xe0
\xf0
\xff
"
,
((
0
,
64
,
127
,), (
-
32
,
-
16
,
-
1
,),)
)
def
testFixArray
():
check
(
b"
\x92
\x90
\x91
\x91
\xc0
"
,
((),((
None
,),),),
)
def
testFixRaw
():
check
(
b"
\x94
\xa0
\xa1
a
\xa2
bc
\xa3
def"
,
(
b""
,
b"a"
,
b"bc"
,
b"def"
,),
)
def
testFixMap
():
check
(
b"
\x82
\xc2
\x81
\xc0
\xc0
\xc3
\x81
\xc0
\x80
"
,
{
False
: {
None
:
None
},
True
:{
None
:{}}},
)
def
testUnsignedInt
():
check
(
b"
\x99
\xcc
\x00
\xcc
\x80
\xcc
\xff
\xcd
\x00
\x00
\xcd
\x80
\x00
"
b"
\xcd
\xff
\xff
\xce
\x00
\x00
\x00
\x00
\xce
\x80
\x00
\x00
\x00
"
b"
\xce
\xff
\xff
\xff
\xff
"
,
(
0
,
128
,
255
,
0
,
32768
,
65535
,
0
,
2147483648
,
4294967295
,),
)
def
testSignedInt
():
check
(
b"
\x99
\xd0
\x00
\xd0
\x80
\xd0
\xff
\xd1
\x00
\x00
\xd1
\x80
\x00
"
b"
\xd1
\xff
\xff
\xd2
\x00
\x00
\x00
\x00
\xd2
\x80
\x00
\x00
\x00
"
b"
\xd2
\xff
\xff
\xff
\xff
"
,
(
0
,
-
128
,
-
1
,
0
,
-
32768
,
-
1
,
0
,
-
2147483648
,
-
1
,))
def
testRaw
():
check
(
b"
\x96
\xda
\x00
\x00
\xda
\x00
\x01
a
\xda
\x00
\x02
ab
\xdb
\x00
\x00
"
b"
\x00
\x00
\xdb
\x00
\x00
\x00
\x01
a
\xdb
\x00
\x00
\x00
\x02
ab"
,
(
b""
,
b"a"
,
b"ab"
,
b""
,
b"a"
,
b"ab"
))
def
testArray
():
check
(
b"
\x96
\xdc
\x00
\x00
\xdc
\x00
\x01
\xc0
\xdc
\x00
\x02
\xc2
\xc3
\xdd
\x00
"
b"
\x00
\x00
\x00
\xdd
\x00
\x00
\x00
\x01
\xc0
\xdd
\x00
\x00
\x00
\x02
"
b"
\xc2
\xc3
"
,
((), (
None
,), (
False
,
True
), (), (
None
,), (
False
,
True
))
)
def
testMap
():
check
(
b"
\x96
"
b"
\xde
\x00
\x00
"
b"
\xde
\x00
\x01
\xc0
\xc2
"
b"
\xde
\x00
\x02
\xc0
\xc2
\xc3
\xc2
"
b"
\xdf
\x00
\x00
\x00
\x00
"
b"
\xdf
\x00
\x00
\x00
\x01
\xc0
\xc2
"
b"
\xdf
\x00
\x00
\x00
\x02
\xc0
\xc2
\xc3
\xc2
"
,
({}, {
None
:
False
}, {
True
:
False
,
None
:
False
}, {},
{
None
:
False
}, {
True
:
False
,
None
:
False
}))
Back
|
FazBrowse Home
|
New Git URL