Remove json.dumps from test_api.py

Remove unnecessary changes to tests, revert assertions back to how they were.

Remove unnecessary join from formatter in `_api.py`
This commit is contained in:
Chris Howell 2020-07-09 00:06:14 -07:00
parent 1c0d584959
commit 5861bdb104
2 changed files with 8 additions and 8 deletions

View File

@ -133,8 +133,8 @@ class YouTubeTranscriptApi():
Formatter = formats.get_formatter(format)
transcript = cls.list_transcripts(
video_id,proxies, cookies).find_transcript(languages).fetch()
return ''.join(Formatter.format(transcript))
return Formatter.format(transcript)
@classmethod
def _load_cookies(cls, cookies, video_id):
cookie_jar = {}

View File

@ -50,11 +50,11 @@ class TestYouTubeTranscriptApi(TestCase):
self.assertEqual(
transcript,
json.dumps([
[
{'text': 'Hey, this is just a test', 'start': 0.0, 'duration': 1.54},
{'text': 'this is not the original transcript', 'start': 1.54, 'duration': 4.16},
{'text': 'just something shorter, I made up for testing', 'start': 5.7, 'duration': 3.239}
])
]
)
def test_list_transcripts(self):
@ -165,11 +165,11 @@ class TestYouTubeTranscriptApi(TestCase):
)
self.assertEqual(
transcript,
json.dumps([
[
{'text': 'Hey, this is just a test', 'start': 0.0, 'duration': 1.54},
{'text': 'this is not the original transcript', 'start': 1.54, 'duration': 4.16},
{'text': 'just something shorter, I made up for testing', 'start': 5.7, 'duration': 3.239}
])
]
)
def test_get_transcript__with_cookies(self):
@ -179,11 +179,11 @@ class TestYouTubeTranscriptApi(TestCase):
self.assertEqual(
transcript,
json.dumps([
[
{'text': 'Hey, this is just a test', 'start': 0.0, 'duration': 1.54},
{'text': 'this is not the original transcript', 'start': 1.54, 'duration': 4.16},
{'text': 'just something shorter, I made up for testing', 'start': 5.7, 'duration': 3.239}
])
]
)
@patch('youtube_transcript_api.YouTubeTranscriptApi.get_transcript')