def test_sharpen_should_sharpen_sharp(self):
    expected_semitone = Semitone('D',sharps=2)
    instance = Semitone('D',sharps=1)

    result = instance.sharpen()

    self.assertSame(result,expected_semitone)
  def test_normailze_should_normalize_irregular_flat_semitones(self):
    expected_semitone = Semitone('E')
    instance = Semitone('F',flats=1)

    result = instance.normalize()
   
    self.assertSame(result,expected_semitone)
  def test_normailze_should_normalize_irregular_sharp_semitones(self):
    expected_semitone = Semitone('C')
    instance = Semitone('B',sharps=1)

    result = instance.normalize()
   
    self.assertSame(result,expected_semitone)
  def test_normailze_should_normalize_when_both_flats_and_sharps_are_nonzero(self):
    expected_semitone = Semitone('D',sharps=1)
    instance = Semitone('D',flats=1,sharps=2)

    result = instance.normalize()
   
    self.assertSame(result,expected_semitone)
  def test_normailze_should_normalize_when_more_than_one_sharp(self):
    expected_semitone = Semitone('E')
    instance = Semitone('D',sharps=2)

    result = instance.normalize()
   
    self.assertSame(result,expected_semitone)
  def test_flatten_should_neutralize_sharp(self):
    expected_semitone = Semitone('D')
    instance = Semitone('D',sharps=1)

    result = instance.flatten()

    self.assertSame(result,expected_semitone)
  def test_normailze_should_reduce_flats_when_more_than_12(self):
    expected_semitone = Semitone('D', flats=1)
    instance = Semitone('D',flats=13)

    result = instance.normalize()
   
    self.assertSame(result,expected_semitone)
  def test_normailze_should_do_nothing_to_normalized_flat_semitone(self):
    expected_semitone = Semitone('D',flats=1)
    instance = Semitone('D',flats=1)

    result = instance.normalize()
   
    self.assertSame(result,expected_semitone)
  def test_flatten_should_flatten_flat(self):
    expected_semitone = Semitone('D',flats=2)
    instance = Semitone('D',flats=1)

    result = instance.flatten()

    self.assertSame(result,expected_semitone)
  def test_as_note_with_same_note_should_do_nothing(self):
    expected_semitone = Semitone('D')
    instance = Semitone('D')

    result = instance.as_note('D')

    self.assertSame(result,expected_semitone)
  def test_constructor_with_lowercase_note_should_work(self):
    instance = Semitone('d',sharps=1,flats=2)

    self.assertIsNotNone(instance)
    self.assertEqual(instance.note,'D')
    self.assertEqual(instance.sharps,1)
    self.assertEqual(instance.flats,2)
  def test_str_should_display_not_normalize_display(self):
    expected_str= 'D##bb'
    instance = Semitone('D',sharps=2,flats=2)

    result = str(instance)

    self.assertEqual(result,expected_str)
  def test_str_should_display_double_flats_correctly(self):
    expected_str= 'Dbb'
    instance = Semitone('D',flats=2)

    result = str(instance)

    self.assertEqual(result,expected_str)
  def test_str_should_display_sharps_correctly(self):
    expected_str= 'D#'
    instance = Semitone('D',sharps=1)

    result = str(instance)

    self.assertEqual(result,expected_str)
  def test_str_should_display_naturals_correctly(self):
    expected_str= 'D'
    instance = Semitone('D')

    result = str(instance)

    self.assertEqual(result,expected_str)
Exemplo n.º 16
0
 def test_locate_frets_for_semitone_on_standard_guitar(self):
     instance = guitar.STANDARD_TUNING
     semitone = Semitone.from_string('G')
     expected_result = ((3, 15), (10, 22), (5, 17), (0, 12), (8, 20), (3,
                                                                       15))
     result = instance.locate_frets_for_semitone(semitone)
     self.assertEquals(result, expected_result)
    def test_locate_should_generate_open_d_major_chord(self):
        instance = ChordLocator(guitar.STANDARD_TUNING)

        semitone = Semitone.from_string('D')
        open_chord = (None, None, 0, 2, 3, 2)

        result = instance.locate(semitone, 'major')

        self.assertIn(open_chord, result)
Exemplo n.º 18
0
    def test_locate_frets_for_semitone_on_string_should_work_for_open_note(
            self):
        instance = guitar.STANDARD_TUNING
        semitone = Semitone.from_string('E')
        expected_result = (0, 12)

        result = instance.locate_frets_for_semitone_on_string(0, semitone)

        self.assertEquals(result, expected_result)
def convert_to_semitones(scenario):
    root = Semitone.from_string(scenario[0])
    scale_type = scenario[1]
    expected_scale = tuple(map(Semitone.from_string, scenario[2]))
    return (root, scale_type, expected_scale)
  def test_equals_should_return_false_with_different_note(self):
    instance = Semitone('D')
    not_equal_semitone = Semitone('E')

    self.assertNotEqual(instance,not_equal_semitone)
  def test_from_string_with_natural_should_create_correct_semiton(self):
    expected_semitone = Semitone('D')
    result = Semitone.from_string('D')

    self.assertSame(result,expected_semitone)
  def test_equals_should_return_true_with_unnormalized_form_of_semitone(self):
    instance = Semitone('D')
    equal_semitone = Semitone('D',flats=1,sharps=1)

    self.assertEqual(instance,equal_semitone)
  def test_equals_should_return_true_with_different_form_of_same_semitone(self):
    instance = Semitone('D')
    equal_semitone = Semitone('E',flats=2)

    self.assertEqual(instance,equal_semitone)
  def test_equals_should_return_true_with_same_instanace(self):
    instance = Semitone('D')

    self.assertEqual(instance,instance)
  def test_equals_should_return_true_with_same_property_values(self):
    instance = Semitone('D')
    equal_semitone = Semitone('D')

    self.assertEqual(instance,equal_semitone)
 def test_from_string_with_sharps_and_flats_should_create_correct_semitone(self):
   expected_semitone = Semitone('D',flats=2,sharps=1)
   result = Semitone.from_string('D#bb')
   
   self.assertSame(result,expected_semitone)
  def test_constructor_should_default_sharps_to_zero(self):
    instance = Semitone('D')

    self.assertEqual(instance.sharps,0)
 def test_from_string_with_sharp_should_create_correct_semitone(self):
   expected_semitone = Semitone('D',sharps=2)
   result = Semitone.from_string('D##')
   
   self.assertSame(result,expected_semitone)
  def test_is_sharp_should_return_false_when_more_flats_than_sharps(self):
    instance = Semitone('D', flats = 1)

    self.assertFalse(instance.is_sharp)
  def test_is_sharp_should_return_false_when_equal_number_of_flats_and_sharps(self):
    instance = Semitone('D', sharps=1, flats=1)

    self.assertFalse(instance.is_sharp)