From 9078726e462864c1b45aeb9adfb6114db139fc89 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 9 Oct 2024 12:49:15 +0200 Subject: [PATCH] removed old tests --- tests/__init__.py | 0 tests/conftest.py | 12 ++++++++---- tests/test_cif.py | 47 ----------------------------------------------- tests/test_gcd.py | 35 ----------------------------------- 4 files changed, 8 insertions(+), 86 deletions(-) create mode 100644 tests/__init__.py delete mode 100644 tests/test_cif.py delete mode 100644 tests/test_gcd.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/conftest.py b/tests/conftest.py index 30a84fea..d246c788 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,8 @@ import pytest import json from converter_app.app import create_app +from converter_app.readers.helper.base import Reader + @pytest.fixture() def app(): @@ -27,6 +29,7 @@ def client(app): def runner(app): return app.test_cli_runner() + @pytest.fixture() def reader_params(): client_id = 'dev' @@ -36,11 +39,12 @@ def reader_params(): data = json.loads(f.read()) return { - 'client_id': client_id, - 'reader_data': data, - 'reader_id': reader_id, + 'client_id': client_id, + 'reader_data': data, + 'reader_id': reader_id, } + @pytest.fixture() def test_reader(reader_params): - return Reader(**reader_params) \ No newline at end of file + return Reader(**reader_params) diff --git a/tests/test_cif.py b/tests/test_cif.py deleted file mode 100644 index ddea1875..00000000 --- a/tests/test_cif.py +++ /dev/null @@ -1,47 +0,0 @@ -import os - -from werkzeug.datastructures import FileStorage - -from converter_app.models import File -from converter_app.readers import registry - - -def test_find_reader_cif_generic(app): - test_file = "./tests/sample_files/SG-V3545-6-13.cif" - with open(test_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(test_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file) - assert reader.identifier == 'cif_reader' - - test_file = "./tests/sample_files/zipped_cif.zip" - with open(test_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(test_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file) - assert reader.identifier == 'cif_reader' - - test_file = "./tests/sample_files/zipped_cfx_cif.zip" - with open(test_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(test_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file) - assert reader.identifier == 'cif_reader' - -def test_find_reader_cfx_generic(app): - test_file = "./tests/sample_files/SG-V3551-15-19.cfx_LANA" - with open(test_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(test_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file) - assert reader.identifier == 'cfx_reader' - - test_file = "./tests/sample_files/zipped_cfx.zip" - with open(test_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(test_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file) - assert reader.identifier == 'cfx_reader' - -def test_processing(app): - pass diff --git a/tests/test_gcd.py b/tests/test_gcd.py deleted file mode 100644 index 35c96ef7..00000000 --- a/tests/test_gcd.py +++ /dev/null @@ -1,35 +0,0 @@ -import os - -from werkzeug.datastructures import FileStorage - -from converter_app.models import File -from converter_app.readers import registry - - -def test_find_reader_gcd_generic(app): - gcd_file = "./tests/sample_files/EF-R94.3-40h__GC-BID_inc-5min-30_GC-3min-40-7min-180-2min_Calibrated_292023_904_003.gcd.txt" - with open(gcd_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(gcd_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file, 'dev') - assert reader.identifier == 'gcd_reader' - -def test_processing(app): - gcd_file = "./tests/sample_files/EF-R94.3-40h__GC-BID_inc-5min-30_GC-3min-40-7min-180-2min_Calibrated_292023_904_003.gcd.txt" - with open(gcd_file, 'rb') as f: - fs = FileStorage(stream=f, filename=os.path.basename(gcd_file), content_type='chemical/x-cif') - file = File(fs) - reader = registry.match_reader(file, 'dev') - reader.process() - tables = reader.tables - assert len(tables) == 5 - assert tables[0]['metadata']['[Header].Application Name'] == 'LabSolutions' - assert tables[1]['metadata']['Header'] == '[Compound Results(Ch1)]' - assert tables[2]['metadata']['Header'] == '[Compound Results(Ch2)]' - assert tables[3]['metadata']['Header'] == '[Chromatogram (Ch1)]' - assert tables[4]['metadata']['Header'] == '[Chromatogram (Ch2)]' - - assert len(tables[3]['rows']) == 18001 - assert len(tables[3]['columns']) == 2 - assert len(tables[4]['rows']) == 18001 - assert len(tables[4]['columns']) == 2