@@ -420,9 +420,9 @@ def test_transcription_model_with_all_options():
420
420
reason = "transcription completed successfully" ,
421
421
url = "https://example.com/transcription.json" ,
422
422
primaryLanguageCode = "en-US" ,
423
- hasSummary = True
423
+ hasSummary = True ,
424
424
)
425
-
425
+
426
426
assert transcription .status == "completed"
427
427
assert transcription .reason == "transcription completed successfully"
428
428
assert transcription .url == "https://example.com/transcription.json"
@@ -433,10 +433,9 @@ def test_transcription_model_with_all_options():
433
433
def test_transcription_model_with_partial_options ():
434
434
"""Test that the Transcription model can be created with only some new options."""
435
435
transcription = Transcription (
436
- status = "processing" ,
437
- url = "https://example.com/transcription.json"
436
+ status = "processing" , url = "https://example.com/transcription.json"
438
437
)
439
-
438
+
440
439
assert transcription .status == "processing"
441
440
assert transcription .url == "https://example.com/transcription.json"
442
441
assert transcription .primaryLanguageCode is None
@@ -446,10 +445,8 @@ def test_transcription_model_with_partial_options():
446
445
447
446
def test_transcription_model_with_url_only ():
448
447
"""Test that the Transcription model can be created with just the url option."""
449
- transcription = Transcription (
450
- url = "https://example.com/transcription.json"
451
- )
452
-
448
+ transcription = Transcription (url = "https://example.com/transcription.json" )
449
+
453
450
assert transcription .url == "https://example.com/transcription.json"
454
451
assert transcription .status is None
455
452
assert transcription .reason is None
@@ -458,11 +455,10 @@ def test_transcription_model_with_url_only():
458
455
459
456
460
457
def test_transcription_model_with_primary_language_code_only ():
461
- """Test that the Transcription model can be created with just the primaryLanguageCode option."""
462
- transcription = Transcription (
463
- primaryLanguageCode = "es-ES"
464
- )
465
-
458
+ """Test that the Transcription model can be created with just the primaryLanguageCode
459
+ option."""
460
+ transcription = Transcription (primaryLanguageCode = "es-ES" )
461
+
466
462
assert transcription .primaryLanguageCode == "es-ES"
467
463
assert transcription .status is None
468
464
assert transcription .reason is None
@@ -471,11 +467,10 @@ def test_transcription_model_with_primary_language_code_only():
471
467
472
468
473
469
def test_transcription_model_with_has_summary_only ():
474
- """Test that the Transcription model can be created with just the hasSummary option."""
475
- transcription = Transcription (
476
- hasSummary = False
477
- )
478
-
470
+ """Test that the Transcription model can be created with just the hasSummary
471
+ option."""
472
+ transcription = Transcription (hasSummary = False )
473
+
479
474
assert transcription .hasSummary is False
480
475
assert transcription .status is None
481
476
assert transcription .reason is None
@@ -486,7 +481,7 @@ def test_transcription_model_with_has_summary_only():
486
481
def test_transcription_model_empty ():
487
482
"""Test that the Transcription model can be created with no options set."""
488
483
transcription = Transcription ()
489
-
484
+
490
485
assert transcription .status is None
491
486
assert transcription .reason is None
492
487
assert transcription .url is None
@@ -501,34 +496,30 @@ def test_transcription_model_serialization():
501
496
reason = "success" ,
502
497
url = "https://example.com/transcription.json" ,
503
498
primaryLanguageCode = "en-US" ,
504
- hasSummary = True
499
+ hasSummary = True ,
505
500
)
506
-
501
+
507
502
serialized = transcription .model_dump ()
508
503
expected = {
509
504
"status" : "completed" ,
510
505
"reason" : "success" ,
511
506
"url" : "https://example.com/transcription.json" ,
512
507
"primaryLanguageCode" : "en-US" ,
513
- "hasSummary" : True
508
+ "hasSummary" : True ,
514
509
}
515
-
510
+
516
511
assert serialized == expected
517
512
518
513
519
514
def test_transcription_model_serialization_exclude_unset ():
520
515
"""Test that the Transcription model serializes correctly excluding unset values."""
521
516
transcription = Transcription (
522
- url = "https://example.com/transcription.json" ,
523
- hasSummary = True
517
+ url = "https://example.com/transcription.json" , hasSummary = True
524
518
)
525
-
519
+
526
520
serialized = transcription .model_dump (exclude_unset = True )
527
- expected = {
528
- "url" : "https://example.com/transcription.json" ,
529
- "hasSummary" : True
530
- }
531
-
521
+ expected = {"url" : "https://example.com/transcription.json" , "hasSummary" : True }
522
+
532
523
assert serialized == expected
533
524
assert "status" not in serialized
534
525
assert "reason" not in serialized
@@ -542,11 +533,11 @@ def test_transcription_model_deserialization():
542
533
"reason" : "transcription finished" ,
543
534
"url" : "https://example.com/transcription.json" ,
544
535
"primaryLanguageCode" : "fr-FR" ,
545
- "hasSummary" : True
536
+ "hasSummary" : True ,
546
537
}
547
-
538
+
548
539
transcription = Transcription (** data )
549
-
540
+
550
541
assert transcription .status == "completed"
551
542
assert transcription .reason == "transcription finished"
552
543
assert transcription .url == "https://example.com/transcription.json"
@@ -556,16 +547,8 @@ def test_transcription_model_deserialization():
556
547
557
548
def test_transcription_model_with_various_language_codes ():
558
549
"""Test that the Transcription model accepts various language codes."""
559
- test_cases = [
560
- "en-US" ,
561
- "es-ES" ,
562
- "fr-FR" ,
563
- "de-DE" ,
564
- "ja-JP" ,
565
- "zh-CN" ,
566
- "pt-BR"
567
- ]
568
-
550
+ test_cases = ["en-US" , "es-ES" , "fr-FR" , "de-DE" , "ja-JP" , "zh-CN" , "pt-BR" ]
551
+
569
552
for lang_code in test_cases :
570
553
transcription = Transcription (primaryLanguageCode = lang_code )
571
554
assert transcription .primaryLanguageCode == lang_code
@@ -578,9 +561,9 @@ def test_transcription_model_with_various_urls():
578
561
"https://storage.googleapis.com/bucket/file.json" ,
579
562
"https://s3.amazonaws.com/bucket/transcription.txt" ,
580
563
"http://example.org/path/to/transcription" ,
581
- "https://vonage.example.com/transcriptions/12345"
564
+ "https://vonage.example.com/transcriptions/12345" ,
582
565
]
583
-
566
+
584
567
for url in test_urls :
585
568
transcription = Transcription (url = url )
586
569
assert transcription .url == url
@@ -591,19 +574,20 @@ def test_transcription_model_boolean_has_summary():
591
574
# Test True
592
575
transcription_true = Transcription (hasSummary = True )
593
576
assert transcription_true .hasSummary is True
594
-
577
+
595
578
# Test False
596
579
transcription_false = Transcription (hasSummary = False )
597
580
assert transcription_false .hasSummary is False
598
-
581
+
599
582
# Test None (default)
600
583
transcription_none = Transcription ()
601
584
assert transcription_none .hasSummary is None
602
585
603
586
604
587
@responses .activate
605
588
def test_archive_with_transcription_options ():
606
- """Test that Archive model properly deserializes with transcription containing new options."""
589
+ """Test that Archive model properly deserializes with transcription containing new
590
+ options."""
607
591
build_response (
608
592
path ,
609
593
'GET' ,
@@ -615,7 +599,7 @@ def test_archive_with_transcription_options():
615
599
616
600
assert archive .id == '5b1521e6-115f-4efd-bed9-e527b87f0699'
617
601
assert archive .has_transcription is True
618
-
602
+
619
603
# Test transcription object and its new properties
620
604
assert archive .transcription is not None
621
605
assert archive .transcription .status == "completed"
@@ -645,7 +629,7 @@ def test_list_archives_with_transcription_options():
645
629
if archive .has_transcription :
646
630
transcribed_archive = archive
647
631
break
648
-
632
+
649
633
assert transcribed_archive is not None
650
634
assert transcribed_archive .transcription is not None
651
635
assert transcribed_archive .transcription .url is not None
0 commit comments