Best Python code snippet using localstack_python
test_transcribe_boto3.py
Source:test_transcribe_boto3.py
...200 client.start_medical_transcription_job.when.called_with(**args).should.throw(201 client.exceptions.BadRequestException202 )203@mock_transcribe204def test_list_medical_transcription_jobs():205 region_name = "us-east-1"206 client = boto3.client("transcribe", region_name=region_name)207 def run_job(index, target_status):208 job_name = "Job_{}".format(index)209 args = {210 "MedicalTranscriptionJobName": job_name,211 "LanguageCode": "en-US",212 "Media": {"MediaFileUri": "s3://my-bucket/my-media-file.wav",},213 "OutputBucketName": "my-output-bucket",214 "Specialty": "PRIMARYCARE",215 "Type": "CONVERSATION",216 }217 resp = client.start_medical_transcription_job(**args)218 resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)219 # IMPLICITLY PROMOTE JOB STATUS TO QUEUED220 resp = client.get_medical_transcription_job(221 MedicalTranscriptionJobName=job_name222 )223 # IN_PROGRESS224 if target_status in ["IN_PROGRESS", "COMPLETED"]:225 resp = client.get_medical_transcription_job(226 MedicalTranscriptionJobName=job_name227 )228 # COMPLETED229 if target_status == "COMPLETED":230 resp = client.get_medical_transcription_job(231 MedicalTranscriptionJobName=job_name232 )233 # Run 5 pending jobs234 for i in range(5):235 run_job(i, "PENDING")236 # Run 10 job to IN_PROGRESS237 for i in range(5, 15):238 run_job(i, "IN_PROGRESS")239 # Run 15 job to COMPLETED240 for i in range(15, 30):241 run_job(i, "COMPLETED")242 # List all243 response = client.list_medical_transcription_jobs()244 response.should.contain("MedicalTranscriptionJobSummaries")245 len(response["MedicalTranscriptionJobSummaries"]).should.equal(30)246 response.shouldnt.contain("NextToken")247 response.shouldnt.contain("Status")248 # List IN_PROGRESS249 response = client.list_medical_transcription_jobs(Status="IN_PROGRESS")250 response.should.contain("MedicalTranscriptionJobSummaries")251 len(response["MedicalTranscriptionJobSummaries"]).should.equal(10)252 response.shouldnt.contain("NextToken")253 response.should.contain("Status")254 response["Status"].should.equal("IN_PROGRESS")255 # List JobName contains "8"256 response = client.list_medical_transcription_jobs(JobNameContains="8")257 response.should.contain("MedicalTranscriptionJobSummaries")258 len(response["MedicalTranscriptionJobSummaries"]).should.equal(3)259 response.shouldnt.contain("NextToken")260 response.shouldnt.contain("Status")261 # Pagination by 11262 response = client.list_medical_transcription_jobs(MaxResults=11)263 response.should.contain("MedicalTranscriptionJobSummaries")264 len(response["MedicalTranscriptionJobSummaries"]).should.equal(11)265 response.should.contain("NextToken")266 response.shouldnt.contain("Status")267 response = client.list_medical_transcription_jobs(268 NextToken=response["NextToken"], MaxResults=11269 )270 response.should.contain("MedicalTranscriptionJobSummaries")271 len(response["MedicalTranscriptionJobSummaries"]).should.equal(11)272 response.should.contain("NextToken")273 response = client.list_medical_transcription_jobs(274 NextToken=response["NextToken"], MaxResults=11275 )276 response.should.contain("MedicalTranscriptionJobSummaries")277 len(response["MedicalTranscriptionJobSummaries"]).should.equal(8)278 response.shouldnt.contain("NextToken")279@mock_transcribe280def test_create_medical_vocabulary():281 region_name = "us-east-1"282 client = boto3.client("transcribe", region_name=region_name)283 vocabulary_name = "MyVocabulary"284 resp = client.create_medical_vocabulary(285 VocabularyName=vocabulary_name,286 LanguageCode="en-US",287 VocabularyFileUri="https://s3.us-east-1.amazonaws.com/AWSDOC-EXAMPLE-BUCKET/vocab.txt",...
aws_transcribe_info.py
Source:aws_transcribe_info.py
...117 Status=module.params['status'],118 JobNameContains=module.params['name_contains'],119 ), True120 else:121 return client.list_medical_transcription_jobs(122 Status=module.params['status'],123 JobNameContains=module.params['name_contains'],124 ), False125 elif module.params['list_transcription_jobs']:126 if client.can_paginate('list_transcription_jobs'):127 paginator = client.get_paginator('list_transcription_jobs')128 return paginator.paginate(129 Status=module.params['status'],130 JobNameContains=module.params['name_contains'],131 ), True132 else:133 return client.list_transcription_jobs(134 Status=module.params['status'],135 JobNameContains=module.params['name_contains'],...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!