def test_unpack_sample_width1_shouldpass(): sample_width = 1 value = '\x48' expected = 0x48 actual = pcm.unpack_sample(value, sample_width) assert expected == actual
def test_unpack_sample_mismatched_sizes_throws_exception(): sample_width = 1 value = '\x00\xff' # Should throw exception because sample width and size of value are mismatched. actual = pcm.unpack_sample(value, sample_width)
def test_unpack_sample_sample_width3_shouldFail(): sample_width = 3 value = '\x30\x40\x50' # Should throw exception because sample width of 3 isn't supported. pcm.unpack_sample(value, sample_width)
def test_unpack_sample_width2_shouldfail(): sample_width = 2 value = '\x30\x40' incorrect_result = 0x3040 actual = pcm.unpack_sample(value, sample_width) assert incorrect_result != actual
def test_unpack_sample_width2_shouldpass(): sample_width = 2 value = '\x40\x30' expected = 0x3040 actual = pcm.unpack_sample(value, sample_width) assert expected == actual
def test_unpack_sample_width1_shouldfail(): sample_width = 1 value = '\x48' incorrect_result = 0x84 actual = pcm.unpack_sample(value, sample_width) assert incorrect_result != actual