def testOne(self): core.config.chords = TimeList() core.config.harmonies = TimeList() harm = createProblem() addHarmony(harm, Chord("C", None, 0), "I") addHarmonyRules(harm) solutions = solveProblem(harm) self.assertEqual(len(solutions), 42)
def testDiminished(self): core.config.chords = TimeList() core.config.harmonies = TimeList() harm = createProblem() gsharpdim7 = Chord("G#", ["dim7"], 0, "G#") addHarmony(harm, gsharpdim7, "vii7") addHarmonyRules(harm) solutions = solveProblem(harm) firstSolution = solutions[0][1] firstSolution = [x[1] for x in firstSolution] self.assertTrue(self.solutionHasNotes(firstSolution, ["G#", "B", "D", "F"]))
def testSequence(self): core.config.chords = TimeList() core.config.harmonies = TimeList() harm = createProblem() emin = Chord("E", ["min"], 0, "E") A7 = Chord("A", ["7"], 1, "E") dmin = Chord("D", ["min"], 2, "D") G7 = Chord("G", ["7"], 3, "D") C = Chord("C", None, 4, "C") addHarmony(harm, emin, "iii") addHarmony(harm, A7, "V43/ii") addHarmony(harm, dmin, "ii") addHarmony(harm, G7, "V43") addHarmony(harm, C, "I") addHarmonyRules(harm) solutions = solveProblem(harm) self.assertEqual(len(solutions), 128)
def run_test(harm): solveProblem(harm)