def test_middle_e(self, mock_compare_notes): mock_compare_notes.side_effect = [-1, 1] note = ('E', 3) expected = ('E', 2) self.assertEqual(notemappings._lowest_string_with(note), expected) calls = [call(('E', 2), note), call(('E', 4), note)] mock_compare_notes.assert_has_calls(calls)
def test_low_e_open_string(self, mock_compare_notes): mock_compare_notes.side_effect = [0, 1] note = ('E', 2) expected = tuple(note) self.assertEqual(notemappings._lowest_string_with(note), expected) calls = [call(('E', 2), note), call(('E', 4), note)] mock_compare_notes.assert_has_calls(calls)
def test_d_5(self, mock_compare_notes): mock_compare_notes.side_effect = [-1] * 5 + [1] note = ('D', 5) expected = ('D', 3) self.assertEqual(notemappings._lowest_string_with(note), expected) calls = [call(('E', 2), note), call(('E', 4), note), call(('A', 2), note), call(('A', 4), note), call(('D', 3), note), call(('D', 5), note)] mock_compare_notes.assert_has_calls(calls)
def test_g_5(self, mock_compare_notes): mock_compare_notes.side_effect = [-1] * 9 + [1] note = ('G', 5) expected = ('B', 3) self.assertEqual(notemappings._lowest_string_with(note), expected) calls = [call(('E', 2), note), call(('D', 4), note), call(('A', 3), note), call(('G', 4), note), call(('D', 3), note), call(('C', 5), note), call(('G', 3), note), call(('F', 5), note), call(('B', 4), note), call(('A', 6), note)]
def test_off_the_chart(self, mock_compare_notes): mock_compare_notes.side_effect = [-1] * 12 note = ('E', 8) self.assertIsNone(notemappings._lowest_string_with(note))