def test_run__translate(self): YouTubeTranscriptCli( 'v1 v2 --languages de en --translate cz'.split()).run(), self.transcript_mock.translate.assert_any_call('cz')
def test_run__exclude_manually_created_and_generated(self): self.assertEqual( YouTubeTranscriptCli( 'v1 v2 --languages de en --exclude-manually-created --exclude-generated' .split()).run(), '')
def test_run__exclude_generated(self): YouTubeTranscriptCli( 'v1 v2 --languages de en --exclude-generated'.split()).run() self.transcript_list_mock.find_manually_created_transcript.assert_any_call( ['de', 'en'])
def test_argument_parsing__languages(self): parsed_args = YouTubeTranscriptCli( 'v1 v2 --languages de en'.split())._parse_args() self.assertEqual(parsed_args.video_ids, ['v1', 'v2']) self.assertEqual(parsed_args.format, 'pretty') self.assertEqual(parsed_args.languages, ['de', 'en'])
def test_argument_parsing__fail_without_video_ids(self): with self.assertRaises(SystemExit): YouTubeTranscriptCli('--format json'.split())._parse_args()
def test_argument_parsing__video_ids_starting_with_dash(self): parsed_args = YouTubeTranscriptCli( '\-v1 \-\-v2 \--v3'.split())._parse_args() self.assertEqual(parsed_args.video_ids, ['-v1', '--v2', '--v3']) self.assertEqual(parsed_args.format, 'pretty') self.assertEqual(parsed_args.languages, ['en'])