FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-osc/pythonosc/test/test_osc_bundle_builder.py at master · dyfer/python-osc · GitHub
dyfer
/
python-osc
Public
forked from
attwad/python-osc
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
python-osc
/
pythonosc
/
test
/
test_osc_bundle_builder.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (35 loc) · 1.4 KB
Breadcrumbs
python-osc
/
pythonosc
/
test
/
test_osc_bundle_builder.py
Copy path
File metadata and controls
46 lines (35 loc) · 1.4 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
import
unittest
from
pythonosc
import
osc_bundle_builder
from
pythonosc
import
osc_message_builder
class
TestOscBundleBuilder
(
unittest
.
TestCase
):
def
test_empty_bundle
(
self
):
bundle
=
osc_bundle_builder
.
OscBundleBuilder
(
osc_bundle_builder
.
IMMEDIATELY
).
build
()
self
.
assertEqual
(
0
,
bundle
.
num_contents
)
def
test_raises_on_build
(
self
):
bundle
=
osc_bundle_builder
.
OscBundleBuilder
(
0.0
)
bundle
.
add_content
(
None
)
self
.
assertRaises
(
osc_bundle_builder
.
BuildError
,
bundle
.
build
)
def
test_raises_on_invalid_timestamp
(
self
):
bundle
=
osc_bundle_builder
.
OscBundleBuilder
(
"I am not a timestamp"
)
self
.
assertRaises
(
osc_bundle_builder
.
BuildError
,
bundle
.
build
)
def
test_build_complex_bundle
(
self
):
bundle
=
osc_bundle_builder
.
OscBundleBuilder
(
osc_bundle_builder
.
IMMEDIATELY
)
msg
=
osc_message_builder
.
OscMessageBuilder
(
address
=
"/SYNC"
)
msg
.
add_arg
(
4.0
)
# Add 4 messages in the bundle, each with more arguments.
bundle
.
add_content
(
msg
.
build
())
msg
.
add_arg
(
2
)
bundle
.
add_content
(
msg
.
build
())
msg
.
add_arg
(
"value"
)
bundle
.
add_content
(
msg
.
build
())
msg
.
add_arg
(
b"
\x01
\x02
\x03
"
)
bundle
.
add_content
(
msg
.
build
())
sub_bundle
=
bundle
.
build
()
# Now add the same bundle inside itself.
bundle
.
add_content
(
sub_bundle
)
bundle
=
bundle
.
build
()
self
.
assertEqual
(
5
,
bundle
.
num_contents
)
if
__name__
==
"__main__"
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL