diff --git a/tests/test_core_assembly.py b/tests/test_core_assembly.py index c1d673b..16d5e8e 100644 --- a/tests/test_core_assembly.py +++ b/tests/test_core_assembly.py @@ -1,4 +1,3 @@ -import pytest from genomeinfo.core.assembly import AssemblyInfo from genomeinfo.interface import GenomeInfo @@ -7,20 +6,14 @@ def test_assembly_info_human(): db = GenomeInfo.connect() - try: - assembly = db.assembly_info(assembly="GRCh38") - except Exception as e: - pytest.fail(f"Unexpected error: {e}") + assembly = db.assembly_info(assembly="GRCh38") assert isinstance(assembly, AssemblyInfo) assert assembly.assembly == "GRCh38" assert assembly.species == "homo_sapiens" assert assembly.common_name == "human" - try: - assembly = db.assembly_info(assembly="hg38") - except Exception as e: - pytest.fail(f"Unexpected error: {e}") + assembly = db.assembly_info(assembly="hg38") assert isinstance(assembly, AssemblyInfo) assert assembly.assembly == "hg38" diff --git a/tests/test_core_info.py b/tests/test_core_info.py index 300ded0..d863507 100644 --- a/tests/test_core_info.py +++ b/tests/test_core_info.py @@ -9,10 +9,7 @@ def test_method_attachment(): def test_method_execution(): genome_info = GenomeInfo.connect() - try: - genome_info.info() - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + genome_info.info() def test_get_species_info(): @@ -22,10 +19,10 @@ def test_get_species_info(): genome_info, "get_species_info" ), "Method get_species_info is not attached" - try: - genome_info.get_species_info("homo_sapiens") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.get_species_info("homo_sapiens") + + assert rs is not None, "The result is None" + def test_get_assembly_metadata_ncbi(): @@ -35,19 +32,16 @@ def test_get_assembly_metadata_ncbi(): genome_info, "get_assembly_metadata" ), "Method get_assembly_metadata is not attached" - try: - genome_info.get_assembly_metadata("GRCh38") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.get_assembly_metadata("GRCh38") + + assert rs is not None, "The result is None" + def test_get_assembly_metadata_ucsc(): genome_info = GenomeInfo.connect() - try: - rs = genome_info.get_assembly_metadata("hg38") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.get_assembly_metadata("hg38") assert rs is not None, "The result is None" @@ -57,10 +51,7 @@ def test_get_assembly_metadata_ucsc(): def test_get_assembly_metadata_t2t(): genome_info = GenomeInfo.connect() - try: - rs = genome_info.get_assembly_metadata("T2T-CHM13") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.get_assembly_metadata("T2T-CHM13") assert rs is not None, "The result is None" assert len(rs) > 0, "The result if empty" @@ -69,10 +60,7 @@ def test_get_assembly_metadata_t2t(): def test_available_assemblies(): genome_info = GenomeInfo.connect() - try: - rs = genome_info.available_assemblies() - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.available_assemblies() assert rs is not None, "The result is None" assert len(rs) > 0, "The result is empty" @@ -81,10 +69,7 @@ def test_available_assemblies(): def test_get_organism_info(): genome_info = GenomeInfo.connect() - try: - rs = genome_info.get_organism_info("human") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.get_organism_info("human") assert rs is not None, "The result is None" assert len(rs) > 0, "The result is empty" @@ -93,10 +78,7 @@ def test_get_organism_info(): def test_available_patches(): genome_info = GenomeInfo.connect() - try: - rs = genome_info.available_patches() - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.available_patches() assert rs is not None, "The result is None" assert len(rs) > 0, "The result is empty" @@ -105,18 +87,12 @@ def test_available_patches(): def test_available_accessions(): genome_info = GenomeInfo.connect() - try: - rs = genome_info.available_accessions("GRCh38") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.available_accessions("GRCh38") assert rs is not None, "The result is None" assert len(rs) > 0, "The result is empty" - try: - rs = genome_info.available_accessions("hg38") - except Exception as e: - AssertionError(f"Method execution failed: {e!s}") + rs = genome_info.available_accessions("hg38") assert rs is not None, "The result is None" assert len(rs) > 0, "The result is empty"