-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_aseqplay.py
45 lines (34 loc) · 1 KB
/
test_aseqplay.py
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
from __future__ import print_function
import unittest
class Main(unittest.TestCase):
def setUp(self):
try:
from mock import Mock
except:
from unittest.mock import Mock
import alsamidi
self.merge = alsamidi.merge
alsamidi.merge = Mock(return_value=[])
self.Seq = alsamidi.Seq
alsamidi.Seq = Mock()
import aseqplay
aseqplay.print = Mock()
def tearDown(self):
import alsamidi
import aseqplay
alsamidi.merge = self.merge
alsamidi.Seq = self.Seq
del aseqplay.print
def test(self):
import aseqplay
aseqplay.main(128, 'path')
def test_display(self):
import alsamidi
import aseqplay
data = (9, 60, 127, 0, 10)
event = (5, 1, 0, 0, (1, 0), (0, 0), (0, 0), data)
track = [event]
alsamidi.merge.return_value = track
aseqplay.main(128, 'path', display=True)
if __name__ == '__main__':
unittest.main()