-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_constraints.py
54 lines (47 loc) · 1.43 KB
/
test_constraints.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
46
47
48
49
50
51
52
53
54
import pytest
from csp import no_parallel_fifths, no_parallel_octaves
from music21.note import Note
class TestParallelFifths:
def test_no_parallel_fiths_false(self):
s1 = Note('C5')
s2 = Note('D5')
a1 = Note('F4')
a2 = Note('G4')
t1 = Note('C4')
t2 = Note('D4')
b1 = Note('C3')
b2 = Note('D3')
assert not no_parallel_fifths(s1, a1, t1, b1, s2, a2, t2, b2)
def test_no_parallel_fiths_true(self):
s1 = Note('C5')
s2 = Note('D5')
a1 = Note('F4')
a2 = Note('C4')
assert no_parallel_fifths(s1, a1, s2, a2)
class TestParallelOctaves:
def test_no_parallel_octaves_false(self):
s1 = Note('C5')
s2 = Note('D5')
a1 = Note('F4')
a2 = Note('G4')
t1 = Note('C4')
t2 = Note('D4')
b1 = Note('C3')
b2 = Note('D3')
assert not no_parallel_octaves(s1, a1, t1, b1, s2, a2, t2, b2)
def test_no_parallel_octaves_true(self):
s1 = Note('C5')
s2 = Note('D5')
a1 = Note('F4')
a2 = Note('G4')
t1 = Note('C4')
t2 = Note('E4')
b1 = Note('C3')
b2 = Note('F3')
assert no_parallel_octaves(s1, a1, t1, b1, s2, a2, t2, b2)
def test_no_parallel_octaves_same_note(self):
s1 = Note('C5')
s2 = Note('C5')
a1 = Note('C4')
a2 = Note('C4')
assert no_parallel_octaves(s1, a1, s2, a2)