Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-reimonn committed Apr 3, 2024
1 parent babd3ee commit c337c5c
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,26 @@ def test_negation(hsapiens108):
assert result.shape[0] == 22894


def test_seqs_as_int(hsapiens108):
@pytest.mark.parametrize("backend", ["sqlite", "duckdb"])
def test_seqs_as_int(backend):
hsapiens108 = gf.ensembl.annotation("Hsapiens", 108, backend=backend)

result_w_int = hsapiens108.genes(filter=filters.SeqNameFilter(1))
result_w_str = hsapiens108.genes(filter=filters.SeqNameFilter("1"))
pd.testing.assert_frame_equal(
result_w_int.sort_values(by="gene_id").reset_index(drop=True),
result_w_str.sort_values(by="gene_id").reset_index(drop=True),
result_w_int,
result_w_str,
)

result_w_ints = hsapiens108.genes(filter=filters.SeqNameFilter([1, 2]))
result_w_strs = hsapiens108.genes(filter=filters.SeqNameFilter(["1", "2"]))
result_w_mixed = hsapiens108.genes(filter=filters.SeqNameFilter([1, "2"]))

pd.testing.assert_frame_equal(
result_w_ints.sort_values(by="gene_id").reset_index(drop=True),
result_w_strs.sort_values(by="gene_id").reset_index(drop=True),
result_w_ints,
result_w_strs,
)
pd.testing.assert_frame_equal(
result_w_ints.sort_values(by="gene_id").reset_index(drop=True),
result_w_mixed.sort_values(by="gene_id").reset_index(drop=True),
result_w_ints,
result_w_mixed,
)

0 comments on commit c337c5c

Please sign in to comment.