From 6ac8307f7cb8e0d99b694b35ea3669f24715a0f2 Mon Sep 17 00:00:00 2001 From: Alexander_Kabui Date: Thu, 23 Jan 2025 15:56:58 +0300 Subject: Add test assertions for writing data to csv. --- tests/unit/test_rqtl2.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'tests/unit/test_rqtl2.py') diff --git a/tests/unit/test_rqtl2.py b/tests/unit/test_rqtl2.py index 5e4f657..f7830db 100644 --- a/tests/unit/test_rqtl2.py +++ b/tests/unit/test_rqtl2.py @@ -18,8 +18,8 @@ def test_generate_rqtl2_files(mock_write_to_csv): "/tmp/workspace/pheno_file.csv" ) data = {"crosstype": "riself", - "geno_data": [], - "pheno_data": [], + "geno_data": [{"NAME": "Ge_code_1"}], + "pheno_data": [{"NAME": "14343_at"}], "alleles": ["L", "C"], "geno_codes": { "L": 1, @@ -35,6 +35,19 @@ def test_generate_rqtl2_files(mock_write_to_csv): } assert test_results == expected_results + # assert data is written to the csv + expected_calls = [mock.call( + "/tmp/workspace", + "geno_file.csv", + [{"NAME": "Ge_code_1"}] + ), + mock.call( + "/tmp/workspace", + "pheno_file.csv", + [{"NAME": "14343_at"}] + )] + mock_write_to_csv.assert_has_calls(expected_calls) + @pytest.mark.unit_test def test_validate_required_keys(): -- cgit 1.4.1