FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-rtmidi/tests/test_errors.py at master · fuho/python-rtmidi · GitHub
fuho
/
python-rtmidi
Public
forked from
SpotlightKid/python-rtmidi
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
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
70 lines (52 loc) · 2.25 KB
Breadcrumbs
python-rtmidi
/
tests
/
test_errors.py
Copy path
File metadata and controls
70 lines (52 loc) · 2.25 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 -*-
"""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