Skip to content

Commit

Permalink
test(data_handling.request): add test support
Browse files Browse the repository at this point in the history
Adds test coverage for code introduced by
9324872.

See: #2
  • Loading branch information
rbpatt2019 committed Jul 6, 2021
1 parent 9324872 commit bd0f62e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/data_handling/test_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""Tests for the scripts.data_handling.request submodule.
These unit tests are designed to test that genes are passed to the query correctly.
They do not test the API,
as tests of data returned by realworld API queries are best left to integrations tests.
"""

import pandas as pd

from scripts.data_handling.request import lut_check

lut = pd.DataFrame.from_dict({"name": ["abc", "def"], "id": ["a1", "a2"]})


def test_return_none() -> None:
"""It returns None when the gene is not found."""
result = lut_check("ghi", lut)
assert result is None


def test_return_str() -> None:
"""It returns the id when the gene is found."""
result = lut_check("abc", lut)
assert result == "a1"

0 comments on commit bd0f62e

Please sign in to comment.