FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-rtmidi/tests/test_errors.py at master · SpotlightKid/python-rtmidi · GitHub
SpotlightKid
/
python-rtmidi
Public
Notifications
You must be signed in to change notification settings
Fork
68
Star
411
Code
Issues
6
Pull requests
1
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python-rtmidi
/
tests
/
test_errors.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (51 loc) · 2.22 KB
Breadcrumbs
python-rtmidi
/
tests
/
test_errors.py
Copy path
File metadata and controls
69 lines (51 loc) · 2.22 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
#!/usr/bin/env python
"""Tests for the error conditions."""
import
unittest
import
rtmidi
from
rtmidi
import
InvalidPortError
,
InvalidUseError
class
TestErrors
(
unittest
.
TestCase
):
INVALID_PORT_NUMBER
=
9999
INVALID_NAME_TYPES
=
(
0
,
666
,
3.141
,
object
)
def
setUp
(
self
):
self
.
midi_out
=
rtmidi
.
MidiOut
()
self
.
midi_in
=
rtmidi
.
MidiIn
()
def
test_midiout_invalid_client_name_type
(
self
):
for
name
in
self
.
INVALID_NAME_TYPES
:
with
self
.
assertRaises
(
TypeError
):
rtmidi
.
MidiOut
(
rtapi
=
rtmidi
.
API_RTMIDI_DUMMY
,
name
=
name
)
def
test_midiin_invalid_client_name_type
(
self
):
for
name
in
self
.
INVALID_NAME_TYPES
:
with
self
.
assertRaises
(
TypeError
):
rtmidi
.
MidiIn
(
rtapi
=
rtmidi
.
API_RTMIDI_DUMMY
,
name
=
name
)
def
test_midiout_open_invalid_port
(
self
):
with
self
.
assertRaises
(
InvalidPortError
):
self
.
midi_out
.
open_port
(
self
.
INVALID_PORT_NUMBER
)
def
test_midiin_open_invalid_port
(
self
):
with
self
.
assertRaises
(
InvalidPortError
):
self
.
midi_in
.
open_port
(
self
.
INVALID_PORT_NUMBER
)
def
test_midiout_open_invalid_port_name_type
(
self
):
for
name
in
self
.
INVALID_NAME_TYPES
:
with
self
.
assertRaises
(
TypeError
):
self
.
midi_out
.
open_port
(
name
=
name
)
def
test_midiin_open_invalid_port_name_type
(
self
):
for
name
in
self
.
INVALID_NAME_TYPES
:
with
self
.
assertRaises
(
TypeError
):
self
.
midi_in
.
open_port
(
name
=
name
)
def
test_midiout_double_open_port
(
self
):
self
.
midi_out
.
open_port
()
with
self
.
assertRaises
(
InvalidUseError
):
self
.
midi_out
.
open_port
()
def
test_midiin_double_open_port
(
self
):
self
.
midi_in
.
open_port
()
with
self
.
assertRaises
(
InvalidUseError
):
self
.
midi_in
.
open_port
()
def
test_midiout_double_open_virtual_port
(
self
):
self
.
midi_out
.
open_virtual_port
()
with
self
.
assertRaises
(
InvalidUseError
):
self
.
midi_out
.
open_virtual_port
()
def
test_midiin_double_open_virtual_port
(
self
):
self
.
midi_in
.
open_virtual_port
()
with
self
.
assertRaises
(
InvalidUseError
):
self
.
midi_in
.
open_virtual_port
()
if
__name__
==
'__main__'
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL