Skip to content

Commit

Permalink
fix: drop try statements
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrogzi authored and nvictus committed Jul 11, 2024
1 parent ade84b7 commit 63bdbed
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 49 deletions.
11 changes: 2 additions & 9 deletions tests/test_core_assembly.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pytest

from genomeinfo.core.assembly import AssemblyInfo
from genomeinfo.interface import GenomeInfo
Expand All @@ -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"
Expand Down
56 changes: 16 additions & 40 deletions tests/test_core_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand All @@ -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():
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"

0 comments on commit 63bdbed

Please sign in to comment.