def test_init(input_, expected_semitones): if (isinstance(expected_semitones, type) and issubclass(expected_semitones, Exception)): with pytest.raises(expected_semitones): NamedPitchClass(input_) return instance = NamedPitchClass(input_) assert float(instance) == expected_semitones
("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), ]) @pytest.mark.parametrize('input_, expected_semitones', values) def test_init(input_, expected_semitones):
("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), ]) @pytest.mark.parametrize('input_, expected_semitones', values) def test_init(input_, expected_semitones):
("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), ]) @pytest.mark.parametrize("input_, expected_semitones", values) def test_init(input_, expected_semitones):
(('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), (Octave(3), 3), (Octave(5), 5), ]
(("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), (Octave(3), 3), (Octave(5), 5), ]