1
- import contextlib
2
1
from typing import Any , Optional
3
2
from unittest .mock import MagicMock , patch
4
3
@@ -577,12 +576,10 @@ def test_mermaid_base_url_default() -> None:
577
576
578
577
with patch ("requests.get" , return_value = mock_response ) as mock_get :
579
578
# Call the function with base_url=None (default)
580
- # Supress exceptions because we're not interested in the response for this test.
581
- with contextlib .suppress (Exception ):
582
- _render_mermaid_using_api (
583
- "graph TD;\n A --> B;" ,
584
- base_url = None ,
585
- )
579
+ _render_mermaid_using_api (
580
+ "graph TD;\n A --> B;" ,
581
+ base_url = None ,
582
+ )
586
583
587
584
# Verify that the URL was constructed with the default base URL
588
585
assert mock_get .called
@@ -600,12 +597,10 @@ def test_mermaid_base_url_custom() -> None:
600
597
601
598
with patch ("requests.get" , return_value = mock_response ) as mock_get :
602
599
# Call the function with custom base_url.
603
- # Supress exceptions because we're not interested in the response for this test.
604
- with contextlib .suppress (Exception ):
605
- _render_mermaid_using_api (
606
- "graph TD;\n A --> B;" ,
607
- base_url = custom_url ,
608
- )
600
+ _render_mermaid_using_api (
601
+ "graph TD;\n A --> B;" ,
602
+ base_url = custom_url ,
603
+ )
609
604
610
605
# Verify that the URL was constructed with our custom base URL
611
606
assert mock_get .called
@@ -623,12 +618,11 @@ def test_draw_mermaid_png_function_base_url() -> None:
623
618
624
619
with patch ("requests.get" , return_value = mock_response ) as mock_get :
625
620
# Call draw_mermaid_png with custom base_url
626
- with contextlib .suppress (Exception ):
627
- draw_mermaid_png (
628
- "graph TD;\n A --> B;" ,
629
- draw_method = MermaidDrawMethod .API ,
630
- base_url = custom_url ,
631
- )
621
+ draw_mermaid_png (
622
+ "graph TD;\n A --> B;" ,
623
+ draw_method = MermaidDrawMethod .API ,
624
+ base_url = custom_url ,
625
+ )
632
626
633
627
# Verify that the URL was constructed with our custom base URL
634
628
assert mock_get .called
@@ -652,10 +646,7 @@ def test_graph_draw_mermaid_png_base_url() -> None:
652
646
graph .add_edge (start_node , end_node )
653
647
654
648
# Call draw_mermaid_png with custom base_url
655
- with contextlib .suppress (Exception ):
656
- graph .draw_mermaid_png (
657
- draw_method = MermaidDrawMethod .API , base_url = custom_url
658
- )
649
+ graph .draw_mermaid_png (draw_method = MermaidDrawMethod .API , base_url = custom_url )
659
650
660
651
# Verify that the URL was constructed with our custom base URL
661
652
assert mock_get .called
0 commit comments