def test_init(input_, expected_semitones): if (isinstance(expected_semitones, type) and issubclass(expected_semitones, Exception)): with pytest.raises(expected_semitones): NamedPitch(input_) return instance = NamedPitch(input_) assert float(instance) == expected_semitones
def test_NamedInterval_01(pitch_a, pitch_b, name): pitch_a = NamedPitch(pitch_a) pitch_b = NamedPitch(pitch_b) interval = NamedInterval.from_pitch_carriers(pitch_a, pitch_b) assert str(interval) == name assert pitch_a.transpose(interval) == pitch_b assert pitch_b.transpose(-interval) == pitch_a
def written_pitch(self, argument): written_pitch = NamedPitch(argument) self._written_pitch = written_pitch if self.alternative is not None: self.alternative[0].written_pitch = written_pitch
values = [] values.extend((x / 2, x / 2) for x in range(-48, 49)) values.extend([ ("bf,", -14), ("c'", 0), ("cs'", 1), ("gff''", 17), ('', 0), ('dss,,', -32), ('fake', ValueError), (('bf', 2), -14), (('c', 4), 0), (('cs', 4), 1), (('dss', 1), -32), (('gff', 5), 17), (NamedPitch("bs'"), 12), (NamedPitch('c'), -12), (NamedPitch('cf,'), -25), (NamedPitch(), 0), (NamedPitchClass("cs'"), 1), (NamedPitchClass('c'), 0), (NamedPitchClass('cf,'), -1), # TODO: Is this correct? (None, 0), (NumberedPitch("bs'"), 12), (NumberedPitch('c'), -12), (NumberedPitch('cf,'), -25), (NumberedPitch(), 0), (NumberedPitchClass("bs'"), 0), (NumberedPitchClass('c'), 0), (NumberedPitchClass('cf,'), 11), ])
values = [] values.extend((x / 2, (x / 2) % 12) for x in range(-48, 49)) values.extend([ ("bf,", 10), ("c'", 0), ("cs'", 1), ("gff''", 5), ('', 0), ('dss,,', 4), ('fake', ValueError), (('bf', 2), 10), (('c', 4), 0), (('cs', 4), 1), (('dss', 1), 4), (('gff', 5), 5), (NamedPitch("bs'"), 0), (NamedPitch('c'), 0), (NamedPitch('cf,'), 11), (NamedPitch(), 0), (NamedPitchClass("cs'"), 1), (NamedPitchClass('c'), 0), (NamedPitchClass('cf,'), 11), (None, 0), (NumberedPitch("bs'"), 0), (NumberedPitch('c'), 0), (NumberedPitch('cf,'), 11), (NumberedPitch(), 0), (NumberedPitchClass("bs'"), 0), (NumberedPitchClass('c'), 0), (NumberedPitchClass('cf,'), 11), ])
values = [] values.extend((x / 2, (x / 2) % 12) for x in range(-48, 49)) values.extend([ ("bf,", 10), ("c'", 0), ("cs'", 1), ("gff''", 5), ("", 0), ("dss,,", 4), ("fake", ValueError), (("bf", 2), 10), (("c", 4), 0), (("cs", 4), 1), (("dss", 1), 4), (("gff", 5), 5), (NamedPitch("bs'"), 0), (NamedPitch("c"), 0), (NamedPitch("cf,"), 11), (NamedPitch(), 0), (NamedPitchClass("cs'"), 1), (NamedPitchClass("c"), 0), (NamedPitchClass("cf,"), 11), (None, 0), (NumberedPitch("bs'"), 0), (NumberedPitch("c"), 0), (NumberedPitch("cf,"), 11), (NumberedPitch(), 0), (NumberedPitchClass("bs'"), 0), (NumberedPitchClass("c"), 0), (NumberedPitchClass("cf,"), 11), ])
values.extend((x / 2, x / 2) for x in range(-48, 49)) values.extend( [ ("bf,", -14), ("c'", 0), ("cs'", 1), ("gff''", 17), ("", 0), ("dss,,", -32), ("fake", ValueError), (("bf", 2), -14), (("c", 4), 0), (("cs", 4), 1), (("dss", 1), -32), (("gff", 5), 17), (NamedPitch("bs'"), 12), (NamedPitch("c"), -12), (NamedPitch("cf,"), -25), (NamedPitch(), 0), (NamedPitchClass("cs'"), 1), (NamedPitchClass("c"), 0), (NamedPitchClass("cf,"), 11), (None, 0), (NumberedPitch("bs'"), 12), (NumberedPitch("c"), -12), (NumberedPitch("cf,"), -25), (NumberedPitch(), 0), (NumberedPitchClass("bs'"), 0), (NumberedPitchClass("c"), 0), (NumberedPitchClass("cf,"), 11), ]
('fake', ValueError), (('bf', 2), 2), (('c', 4), 4), (('cs', 4), 4), (('dss', 1), 1), (('gff', 5), 5), (-1, -1), (-2, -2), (-3, -3), (-4, -4), (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (NamedPitch("bs'"), 4), (NamedPitch('c'), 3), (NamedPitch('cf,'), 2), (NamedPitch(), 4), (NamedPitchClass("cs'"), 4), (NamedPitchClass('c'), 4), (NamedPitchClass('cf,'), 4), (None, 4), (NumberedPitch("bs'"), 5), (NumberedPitch('c'), 3), (NumberedPitch('cf,'), 1), (NumberedPitch(), 4), (NumberedPitchClass("bs'"), 4), (NumberedPitchClass('c'), 4), (NumberedPitchClass('cf,'), 4), (Octave(), 4),
("fake", ValueError), (("bf", 2), 2), (("c", 4), 4), (("cs", 4), 4), (("dss", 1), 1), (("gff", 5), 5), (-1, -1), (-2, -2), (-3, -3), (-4, -4), (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (NamedPitch("bs'"), 4), (NamedPitch("c"), 3), (NamedPitch("cf,"), 2), (NamedPitch(), 4), (NamedPitchClass("cs'"), 4), (NamedPitchClass("c"), 4), (NamedPitchClass("cf,"), 4), (None, 4), (NumberedPitch("bs'"), 5), (NumberedPitch("c"), 3), (NumberedPitch("cf,"), 1), (NumberedPitch(), 4), (NumberedPitchClass("bs'"), 4), (NumberedPitchClass("c"), 4), (NumberedPitchClass("cf,"), 4), (Octave(), 4),