Mercurial > hg > auditok
changeset 335:8220dfaa03c6
Remove deprecated methods in AudioSource
author | Amine Sehili <amine.sehili@gmail.com> |
---|---|
date | Sat, 26 Oct 2019 16:18:44 +0100 |
parents | f7cbf707a34e |
children | 0e13ef3598f3 |
files | auditok/io.py tests/test_AudioReader.py tests/test_AudioSource.py |
diffstat | 3 files changed, 20 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/auditok/io.py Fri Oct 25 20:56:12 2019 +0100 +++ b/auditok/io.py Sat Oct 26 16:18:44 2019 +0100 @@ -195,15 +195,6 @@ - 'left_samples' if `size` > 'left_samples' """ - def get_sampling_rate(self): - """ Return the number of samples per second of audio stream """ - warnings.warn( - "'get_sampling_rate' is deprecated, use 'sampling_rate' " - "property instead", - DeprecationWarning, - ) - return self.sampling_rate - @property def sampling_rate(self): """ Number of samples per second of audio stream """ @@ -214,15 +205,6 @@ """ Number of samples per second of audio stream """ return self._sampling_rate - def get_sample_width(self): - """ Return the number of bytes used to represent one audio sample """ - warnings.warn( - "'get_sample_width' is deprecated, use 'sample_width' " - "property instead", - DeprecationWarning, - ) - return self.sample_width - @property def sample_width(self): """ Number of bytes used to represent one audio sample """ @@ -233,14 +215,6 @@ """ Number of bytes used to represent one audio sample """ return self._sample_width - def get_channels(self): - """ Return the number of channels of this audio source """ - warnings.warn( - "'get_channels' is deprecated, use 'channels' " "property instead", - DeprecationWarning, - ) - return self.channels - @property def channels(self): """ Number of channels of this audio source """
--- a/tests/test_AudioReader.py Fri Oct 25 20:56:12 2019 +0100 +++ b/tests/test_AudioReader.py Sat Oct 26 16:18:44 2019 +0100 @@ -594,7 +594,7 @@ "Wrong sampling rate, expected: 16000, found: {0}".format(srate), ) - def test_ADS_BAS_get_sample_width(self): + def test_ADS_BAS_sample_width(self): swidth = self.ads.sample_width self.assertEqual( swidth, @@ -602,7 +602,7 @@ "Wrong sample width, expected: 2, found: {0}".format(swidth), ) - def test_ADS_BAS_get_channels(self): + def test_ADS_BAS_channels(self): channels = self.ads.channels self.assertEqual( channels,
--- a/tests/test_AudioSource.py Fri Oct 25 20:56:12 2019 +0100 +++ b/tests/test_AudioSource.py Sat Oct 26 16:18:44 2019 +0100 @@ -189,24 +189,24 @@ msg="wrong block, expected: {}, found: {} ".format(None, block), ) - def test_sr10_sw1_ch1_get_sampling_rate(self): - srate = self.audio_source.get_sampling_rate() + def test_sr10_sw1_ch1_sampling_rate(self): + srate = self.audio_source.sampling_rate self.assertEqual( srate, 10, msg="wrong sampling rate, expected: 10, found: {0} ".format(srate), ) - def test_sr10_sw1_ch1_get_sample_width(self): - swidth = self.audio_source.get_sample_width() + def test_sr10_sw1_ch1_sample_width(self): + swidth = self.audio_source.sample_width self.assertEqual( swidth, 1, msg="wrong sample width, expected: 1, found: {0} ".format(swidth), ) - def test_sr10_sw1_ch1_get_channels(self): - channels = self.audio_source.get_channels() + def test_sr10_sw1_ch1_channels(self): + channels = self.audio_source.channels self.assertEqual( channels, 1, @@ -527,25 +527,25 @@ msg="wrong block, expected: {0}, found: {1} ".format(None, block), ) - def test_sr16_sw2_ch1_get_sampling_rate(self): - srate = self.audio_source.get_sampling_rate() + def test_sr16_sw2_ch1_sampling_rate(self): + srate = self.audio_source.sampling_rate self.assertEqual( srate, 16, msg="wrong sampling rate, expected: 10, found: {0} ".format(srate), ) - def test_sr16_sw2_ch1_get_sample_width(self): - swidth = self.audio_source.get_sample_width() + def test_sr16_sw2_ch1_sample_width(self): + swidth = self.audio_source.sample_width self.assertEqual( swidth, 2, msg="wrong sample width, expected: 1, found: {0} ".format(swidth), ) - def test_sr16_sw2_ch1_get_channels(self): + def test_sr16_sw2_ch1_channels(self): - channels = self.audio_source.get_channels() + channels = self.audio_source.channels self.assertEqual( channels, 1, @@ -808,24 +808,24 @@ msg="wrong block, expected: {0}, found: {1} ".format(None, block), ) - def test_sr11_sw4_ch1_get_sampling_rate(self): - srate = self.audio_source.get_sampling_rate() + def test_sr11_sw4_ch1_sampling_rate(self): + srate = self.audio_source.sampling_rate self.assertEqual( srate, 11, msg="wrong sampling rate, expected: 10, found: {0} ".format(srate), ) - def test_sr11_sw4_ch1_get_sample_width(self): - swidth = self.audio_source.get_sample_width() + def test_sr11_sw4_ch1_sample_width(self): + swidth = self.audio_source.sample_width self.assertEqual( swidth, 4, msg="wrong sample width, expected: 1, found: {0} ".format(swidth), ) - def test_sr11_sw4_ch1_get_channels(self): - channels = self.audio_source.get_channels() + def test_sr11_sw4_ch1_channels(self): + channels = self.audio_source.channels self.assertEqual( channels, 1,