Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Check formatting
run: black --check gnomad tests
- name: Check docstrings
run: pydocstyle gnomad
run: pydocstyle gnomad tests
- name: Run Pylint
run: ./lint
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions .pydocstylerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[pydocstyle]
convention = pep257
match = .*\.py
add-ignore =
D105, # Ignore missing docstring for magic methods.
D107 # Ignore missing docstring for __init__ method. Parameters are documented in the class docstring.
15 changes: 15 additions & 0 deletions tests/resources/test_resource_utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
"""Tests for resource classes."""

from unittest.mock import patch

from gnomad.resources import resource_utils


class TestTableResource:
"""Tests for TableResource."""

@patch("hail.read_table")
def test_read_table(self, read_table):
"""Test that Table is read from path."""
resource = resource_utils.TableResource("gs://gnomad-public/table.ht")

ds = resource.ht()
Expand All @@ -14,8 +19,11 @@ def test_read_table(self, read_table):


class TestMatrixTableResource:
"""Tests for MatrixTableResource."""

@patch("hail.read_matrix_table")
def test_read_matrix_table(self, read_matrix_table):
"""Test that MatrixTable is read from path."""
resource = resource_utils.MatrixTableResource(
"gs://gnomad-public/matrix_table.mt"
)
Expand All @@ -26,8 +34,11 @@ def test_read_matrix_table(self, read_matrix_table):


class TestPedigreeResource:
"""Tests for PedigreeResource."""

@patch("hail.Pedigree.read")
def test_read_pedigree(self, read_pedigree):
"""Test that Pedigree is read from path."""
resource = resource_utils.PedigreeResource("gs://gnomad-public/pedigree.ped")

ds = resource.pedigree()
Expand All @@ -38,6 +49,7 @@ def test_read_pedigree(self, read_pedigree):

@patch("hail.import_fam")
def test_read_fam(self, import_fam):
"""Test that Table is imported from path."""
resource = resource_utils.PedigreeResource("gs://gnomad-public/pedigree.fam")

ds = resource.ht()
Expand All @@ -47,8 +59,11 @@ def test_read_fam(self, import_fam):


class TestBlockMatrixResource:
"""Tests for BlockMatrixResource."""

@patch("hail.linalg.BlockMatrix.read")
def test_read_block_matrix(self, read_block_matrix):
"""Test that BlockMatrix is read from path."""
resource = resource_utils.BlockMatrixResource(
"gs://gnomad-public/block_matrix.bm"
)
Expand Down