示例#1
0
 def test_minconf_inescapable3(self):
     # 1 conflict no matter what.
     pcs = PcSet('78AB')
     answer = 'G Ab Bb B'
     # Similar to test above.
     # Screening against double accidental 'Ab A#'
     self.assertEqual(notes(pcs), answer)
示例#2
0
 def test_minconf_neighbor1(self):
     # Tests neighbor conflict in an ordered set, part 1.
     pcs = PcSet('AB9')
     answer = 'A# B A'  # 1 conflict.
     # 'Bb B A' also has 1 conflict, but A is not neighboring.
     # Therefore B pushes Bb to A#, a less popular note.
     self.assertEqual(notes(pcs), answer)
示例#3
0
 def test_minconf_inescapable2(self):
     # 1 conflict no matter what.
     pcs = PcSet('5689')
     answer = 'F F# G# A'
     # Similar to test above.
     # Screening against double accidental 'Gb G#'
     self.assertEqual(notes(pcs), answer)
示例#4
0
 def test_minconf_inescapable1(self):
     # 1 conflict no matter what.
     pcs = PcSet('0134')
     answer = 'C Db Eb E'
     # 'C C# D# E' also valid, but not as popular.
     # 'C Db D# E' also technically valid, but double accidental ugly.
     # Worst answer = 'C C# Eb E' (2 conflicts)
     self.assertEqual(notes(pcs), answer)
示例#5
0
 def test_empty_pcs(self):
     pcs = PcSet([])
     self.assertEqual(notes(pcs), '')
示例#6
0
 def test_alternative_scale_reproduction(self):
     for entry in ALTERNATIVE_SCALES:
         spec = [e.strip() for e in entry.split('=')]
         self.assertEqual(notes(spec[0]), spec[1])
示例#7
0
 def test_major_scale_reproduction(self):
     majorscale = PcSet('024579B')
     for n in range(12):
         answer = PROPER_SCALE_FORMS[n].strip()
         self.assertEqual(notes(majorscale.T(n)), answer)
示例#8
0
 def test_pcs_sharppref(self):
     self.assertEqual(notes(self.chrom, pref='#'),
                      'C C# D D# E F F# G G# A A# B')
示例#9
0
 def test_spec_compatibility(self):
     self.assertEqual(notes('0123456789AB'), notes(self.chrom))
示例#10
0
 def test_minconf_original(self):
     # The set where the whole idea started.
     pcs = PcSet('AB01')
     answer = 'A# B C Db'  # 0 namespace conflicts.
     self.assertEqual(notes(pcs), answer)
示例#11
0
 def test_list_compatibility(self):
     self.assertEqual(notes(range(12)), notes(self.chrom))
示例#12
0
 def test_pcs_sharppref_unicode(self):
     self.assertEqual(
         notes(self.chrom, pref=u'\u266F'),
         u'C C\u266f D D\u266f E F F\u266f G G\u266f A A\u266f B')
示例#13
0
 def test_pcs_flatpref_unicode(self):
     self.assertEqual(
         notes(self.chrom, pref=u'\u266D'),
         u'C D\u266d D E\u266d E F G\u266d G A\u266d A B\u266d B')
示例#14
0
 def test_empty_list(self):
     self.assertEqual(notes([]), '')
示例#15
0
 def test_minconf_neighbor2(self):
     # Tests neighbor conflict in an ordered set, part 2.
     pcs = PcSet('9AB')
     answer = 'A Bb B'  # 1 inescapable conflict w/neighbors.
     # Compare to above.  Deciding factor is popularity.
     self.assertEqual(notes(pcs), answer)
示例#16
0
 def test_empty_spec(self):
     self.assertEqual(notes(''), '')
示例#17
0
 def test_pcs_flatpref(self):
     self.assertEqual(notes(self.chrom, pref='b'),
                      'C Db D Eb E F Gb G Ab A Bb B')