1010
1111import pytest
1212
13- from coprarna import genome , intarna , ncbi , parameters , pipeline , phylogeny
13+ from coprarna import genome , homology , intarna , ncbi , parameters , pipeline , phylogeny
1414from coprarna .cli import main
1515from coprarna .helpers import HELPERS
1616from coprarna .io import open_text , read_text , write_text
@@ -304,7 +304,20 @@ def test_prediction_cache_signature_tracks_contents_not_paths(tmp_path):
304304 assert intarna .prediction_signature (tmp_path , "target.fa" , "query.fa" ) != first
305305
306306
307- def test_report_retains_missing_comparative_pvalues (tmp_path ):
307+ def test_final_result_tables_publish_missing_values_as_empty_fields (tmp_path ):
308+ path = tmp_path / "CopraRNA_result.csv"
309+ path .write_text (
310+ "fdr,p.value,NC_000001,Annotation,Additional.homologs,Amount.sampled,initial_sorting\n "
311+ "NA,NA,,containsNA,NA,0,7\n "
312+ )
313+ assert homology ._finalize_result_table (path ) == ["initial_sorting" , "7" ]
314+ assert path .read_text () == (
315+ "fdr,p-value,NC_000001,Annotation,Additional homologs,Amount sampled\n "
316+ ",,,containsNA,,0\n "
317+ )
318+
319+
320+ def test_web_report_publishes_missing_comparative_pvalues_as_empty_fields (tmp_path ):
308321 from coprarna .webserver import prepare_webserver_output
309322 import shutil
310323
@@ -315,12 +328,16 @@ def test_report_retains_missing_comparative_pvalues(tmp_path):
315328 lines = result .read_text ().splitlines ()
316329 fields = lines [1 ].split ("," )
317330 fields [:2 ] = ["NA" , "NA" ]
331+ fields [- 2 ] = "NA"
318332 lines [1 ] = "," .join (fields )
319333 result .write_text ("\n " .join (lines ) + "\n " )
320334 prepare_webserver_output (result , interactions , tmp_path )
321- assert (tmp_path / "coprarna_internal_table.csv" ).read_text ().splitlines ()[1 ].split (
322- ","
323- )[1 :3 ] == ["NA" , "NA" ]
335+ published = (tmp_path / "coprarna_internal_table.csv" ).read_text ().splitlines ()[
336+ 1
337+ ].split ("," )
338+ assert published [1 :3 ] == ["" , "" ]
339+ assert published [10 ] == ""
340+ assert "NA" not in published
324341
325342
326343def test_all_extended_plot_pages_are_exported_as_vectors (tmp_path , monkeypatch ):
0 commit comments