Skip to content

Commit bb0738f

Browse files
committed
F
1 parent db7d7ba commit bb0738f

File tree

1 file changed

+36
-52
lines changed

1 file changed

+36
-52
lines changed

video/tests/test_archive.py

Lines changed: 36 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ def test_transcription_model_with_all_options():
420420
reason="transcription completed successfully",
421421
url="https://example.com/transcription.json",
422422
primaryLanguageCode="en-US",
423-
hasSummary=True
423+
hasSummary=True,
424424
)
425-
425+
426426
assert transcription.status == "completed"
427427
assert transcription.reason == "transcription completed successfully"
428428
assert transcription.url == "https://example.com/transcription.json"
@@ -433,10 +433,9 @@ def test_transcription_model_with_all_options():
433433
def test_transcription_model_with_partial_options():
434434
"""Test that the Transcription model can be created with only some new options."""
435435
transcription = Transcription(
436-
status="processing",
437-
url="https://example.com/transcription.json"
436+
status="processing", url="https://example.com/transcription.json"
438437
)
439-
438+
440439
assert transcription.status == "processing"
441440
assert transcription.url == "https://example.com/transcription.json"
442441
assert transcription.primaryLanguageCode is None
@@ -446,10 +445,8 @@ def test_transcription_model_with_partial_options():
446445

447446
def test_transcription_model_with_url_only():
448447
"""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+
453450
assert transcription.url == "https://example.com/transcription.json"
454451
assert transcription.status is None
455452
assert transcription.reason is None
@@ -458,11 +455,10 @@ def test_transcription_model_with_url_only():
458455

459456

460457
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+
466462
assert transcription.primaryLanguageCode == "es-ES"
467463
assert transcription.status is None
468464
assert transcription.reason is None
@@ -471,11 +467,10 @@ def test_transcription_model_with_primary_language_code_only():
471467

472468

473469
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+
479474
assert transcription.hasSummary is False
480475
assert transcription.status is None
481476
assert transcription.reason is None
@@ -486,7 +481,7 @@ def test_transcription_model_with_has_summary_only():
486481
def test_transcription_model_empty():
487482
"""Test that the Transcription model can be created with no options set."""
488483
transcription = Transcription()
489-
484+
490485
assert transcription.status is None
491486
assert transcription.reason is None
492487
assert transcription.url is None
@@ -501,34 +496,30 @@ def test_transcription_model_serialization():
501496
reason="success",
502497
url="https://example.com/transcription.json",
503498
primaryLanguageCode="en-US",
504-
hasSummary=True
499+
hasSummary=True,
505500
)
506-
501+
507502
serialized = transcription.model_dump()
508503
expected = {
509504
"status": "completed",
510505
"reason": "success",
511506
"url": "https://example.com/transcription.json",
512507
"primaryLanguageCode": "en-US",
513-
"hasSummary": True
508+
"hasSummary": True,
514509
}
515-
510+
516511
assert serialized == expected
517512

518513

519514
def test_transcription_model_serialization_exclude_unset():
520515
"""Test that the Transcription model serializes correctly excluding unset values."""
521516
transcription = Transcription(
522-
url="https://example.com/transcription.json",
523-
hasSummary=True
517+
url="https://example.com/transcription.json", hasSummary=True
524518
)
525-
519+
526520
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+
532523
assert serialized == expected
533524
assert "status" not in serialized
534525
assert "reason" not in serialized
@@ -542,11 +533,11 @@ def test_transcription_model_deserialization():
542533
"reason": "transcription finished",
543534
"url": "https://example.com/transcription.json",
544535
"primaryLanguageCode": "fr-FR",
545-
"hasSummary": True
536+
"hasSummary": True,
546537
}
547-
538+
548539
transcription = Transcription(**data)
549-
540+
550541
assert transcription.status == "completed"
551542
assert transcription.reason == "transcription finished"
552543
assert transcription.url == "https://example.com/transcription.json"
@@ -556,16 +547,8 @@ def test_transcription_model_deserialization():
556547

557548
def test_transcription_model_with_various_language_codes():
558549
"""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+
569552
for lang_code in test_cases:
570553
transcription = Transcription(primaryLanguageCode=lang_code)
571554
assert transcription.primaryLanguageCode == lang_code
@@ -578,9 +561,9 @@ def test_transcription_model_with_various_urls():
578561
"https://storage.googleapis.com/bucket/file.json",
579562
"https://s3.amazonaws.com/bucket/transcription.txt",
580563
"http://example.org/path/to/transcription",
581-
"https://vonage.example.com/transcriptions/12345"
564+
"https://vonage.example.com/transcriptions/12345",
582565
]
583-
566+
584567
for url in test_urls:
585568
transcription = Transcription(url=url)
586569
assert transcription.url == url
@@ -591,19 +574,20 @@ def test_transcription_model_boolean_has_summary():
591574
# Test True
592575
transcription_true = Transcription(hasSummary=True)
593576
assert transcription_true.hasSummary is True
594-
577+
595578
# Test False
596579
transcription_false = Transcription(hasSummary=False)
597580
assert transcription_false.hasSummary is False
598-
581+
599582
# Test None (default)
600583
transcription_none = Transcription()
601584
assert transcription_none.hasSummary is None
602585

603586

604587
@responses.activate
605588
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."""
607591
build_response(
608592
path,
609593
'GET',
@@ -615,7 +599,7 @@ def test_archive_with_transcription_options():
615599

616600
assert archive.id == '5b1521e6-115f-4efd-bed9-e527b87f0699'
617601
assert archive.has_transcription is True
618-
602+
619603
# Test transcription object and its new properties
620604
assert archive.transcription is not None
621605
assert archive.transcription.status == "completed"
@@ -645,7 +629,7 @@ def test_list_archives_with_transcription_options():
645629
if archive.has_transcription:
646630
transcribed_archive = archive
647631
break
648-
632+
649633
assert transcribed_archive is not None
650634
assert transcribed_archive.transcription is not None
651635
assert transcribed_archive.transcription.url is not None

0 commit comments

Comments
 (0)