@@ -506,6 +506,61 @@ def test_custom_output(acro):
506506 shutil .rmtree (PATH )
507507
508508
509+ def test_blocked_extension (acro , tmp_path ):
510+ """Test that blocked file extensions are rejected in custom output."""
511+ # create temporary files with blocked extensions
512+ svg_file = tmp_path / "test.svg"
513+ svg_file .write_text ("<svg></svg>" )
514+ gph_file = tmp_path / "test.gph"
515+ gph_file .write_text ("data" )
516+
517+ # blocked extensions should be rejected
518+ acro .custom_output (str (svg_file ))
519+ acro .custom_output (str (gph_file ))
520+ assert len (acro .results .results ) == 0
521+
522+ # allowed extensions should be accepted
523+ txt_file = tmp_path / "test.txt"
524+ txt_file .write_text ("hello" )
525+ acro .custom_output (str (txt_file ))
526+ assert len (acro .results .results ) == 1
527+
528+ # case-insensitive check
529+ svg_upper = tmp_path / "test.SVG"
530+ svg_upper .write_text ("<svg></svg>" )
531+ acro .custom_output (str (svg_upper ))
532+ assert len (acro .results .results ) == 1
533+
534+
535+ def test_blocked_extension_hist (data , acro ):
536+ """Test that blocked file extensions are rejected for histograms."""
537+ result = acro .hist (data , "inc_grants" , bins = 1 , filename = "hist.svg" )
538+ assert result is None
539+ assert len (acro .results .results ) == 0
540+
541+
542+ def test_blocked_extension_pie (data , acro ):
543+ """Test that blocked file extensions are rejected for pie charts."""
544+ result = acro .pie (data , "grant_type" , filename = "pie.svg" )
545+ assert result is None
546+ assert len (acro .results .results ) == 0
547+
548+
549+ def test_blocked_extension_survival (acro ):
550+ """Test that blocked file extensions are rejected for survival plots."""
551+ result = acro .survival_plot (
552+ survival_table = pd .DataFrame (),
553+ survival_func = None ,
554+ filename = "surv.svg" ,
555+ status = "pass" ,
556+ sdc = {},
557+ command = "test" ,
558+ summary = "test" ,
559+ )
560+ assert result is None
561+ assert len (acro .results .results ) == 0
562+
563+
509564def test_missing (data , acro , monkeypatch ):
510565 """Pivot table and Crosstab with negative values."""
511566 acro_tables .CHECK_MISSING_VALUES = True
0 commit comments