LTA’s Unit Tests

Unit tests for LTA.

Tests for the parser

Tests for lta.parser.

tests.unit.test_parser.test_correct_usage(capsys: _pytest.capture.CaptureFixture) None

It has the correct usage (ie. structure).

tests.unit.test_parser.test_default_func() None

It has the correct default function.

Tests for the run command function

Tests for the simple command function.

tests.unit.test_commands_run.test_prints_text(capsys: _pytest.capture.CaptureFixture) None

It prints the text.

Tests for the pipeline dataclass

Unit tests for lta.helpers.pipeline.

Testing datahandling can be a challenge, particularly for tools designed to handle compler, “omics” data. At the moment, only the basic error handling is tested. If you can provide any contributions towards better unit tests for data science, please reach out!

tests.unit.test_helpers_pipeline.test_raise_NotDir(mocker: pytest_mock.plugin.MockerFixture, caplog: _pytest.capture.CaptureFixture) None

It handles IsADirectoryErrors.

tests.unit.test_helpers_pipeline.test_raise_NotFound(caplog: _pytest.capture.CaptureFixture) None

It handles FileNotFoundErrors.

tests.unit.test_helpers_pipeline.test_raise_Runtime(mocker: pytest_mock.plugin.MockerFixture, caplog: _pytest.capture.CaptureFixture) None

It fails if a file is empty.

Tests for the jaccard module

Unit tests for the Jaccard module.

tests.unit.test_helpers_jaccard.test_boot() None

It calculates the Jaccard distance.

tests.unit.test_helpers_jaccard.test_boot_all_ones(caplog: _pytest.capture.CaptureFixture) None

It return a p of 1 if all values are True.

tests.unit.test_helpers_jaccard.test_boot_all_zeros(caplog: _pytest.capture.CaptureFixture) None

It return a p of 1 if all values are False.

tests.unit.test_helpers_jaccard.test_boot_pxpy(caplog: _pytest.capture.CaptureFixture) None

It defers to px/py, when passed.

tests.unit.test_helpers_jaccard.test_dist_pxpy() None

It uses px/py when passed.

tests.unit.test_helpers_jaccard.test_distance() None

It calculates the Jaccard distance.

tests.unit.test_helpers_jaccard.test_sim_2d() None

It raises an index error when input is not 1d.

tests.unit.test_helpers_jaccard.test_sim_bool() None

It raises a TypeError when the dtype is not bool.

tests.unit.test_helpers_jaccard.test_sim_center() None

It centers the similarity, when center is True.

tests.unit.test_helpers_jaccard.test_sim_default() None

It returns the Jaccard similarity.

tests.unit.test_helpers_jaccard.test_sim_nan() None

It returns nan when px + py - (px * py) is 0.

tests.unit.test_helpers_jaccard.test_sim_pxpy() None

It uses px/py when passed.

tests.unit.test_helpers_jaccard.test_sim_shape() None

It raises an index error when input is not the same length.

Tests for the FloatRange Custom Type

Unit tests for the lta.helpers.custom_types module.

tests.unit.test_helpers_custom_types.test_FloatRange_attributes() None

It has a start and end value.

tests.unit.test_helpers_custom_types.test_FloatRange_contains() None

It checks the range contains a value.

tests.unit.test_helpers_custom_types.test_FloatRange_iter() None

It is iterable.

tests.unit.test_helpers_custom_types.test_FloatRange_repr(capsys: _pytest.capture.CaptureFixture) None

It correctly prints the repr.