From 938436cad21f43287c71bc99b30aba51363f9481 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 25 Jan 2017 11:00:36 -0800 Subject: [PATCH] Remove default sample_rate. Fixes #2948. --- google-cloud-speech/google/cloud/speech/sample.py | 3 +-- google-cloud-speech/unit_tests/test_sample.py | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/google-cloud-speech/google/cloud/speech/sample.py b/google-cloud-speech/google/cloud/speech/sample.py index fb0ab6ae69de..860524012828 100644 --- a/google-cloud-speech/google/cloud/speech/sample.py +++ b/google-cloud-speech/google/cloud/speech/sample.py @@ -53,7 +53,6 @@ class Sample(object): :param client: (Optional) The client that owns this instance of sample. """ default_encoding = Encoding.FLAC - default_sample_rate = 16000 def __init__(self, content=None, source_uri=None, stream=None, encoding=None, sample_rate=None, client=None): @@ -72,7 +71,7 @@ def __init__(self, content=None, source_uri=None, stream=None, if sample_rate is not None and not 8000 <= sample_rate <= 48000: raise ValueError('The value of sample_rate must be between 8000' ' and 48000.') - self._sample_rate = sample_rate or self.default_sample_rate + self._sample_rate = sample_rate if encoding is not None and getattr(Encoding, encoding, False): self._encoding = getattr(Encoding, encoding) diff --git a/google-cloud-speech/unit_tests/test_sample.py b/google-cloud-speech/unit_tests/test_sample.py index 963ede1f45a3..309de757bfaa 100644 --- a/google-cloud-speech/unit_tests/test_sample.py +++ b/google-cloud-speech/unit_tests/test_sample.py @@ -93,10 +93,6 @@ def test_sample_rates(self): self.assertEqual(sample.sample_rate, self.SAMPLE_RATE) self.assertEqual(sample.encoding, Encoding.FLAC) - sample = self._make_one(source_uri=self.AUDIO_SOURCE_URI, - encoding=Encoding.FLAC) - self.assertEqual(sample.sample_rate, self.SAMPLE_RATE) - def test_encoding(self): from google.cloud.speech.encoding import Encoding