Skip to content

Commit

Permalink
Improve readability of ResidueRepresentations repr
Browse files Browse the repository at this point in the history
  • Loading branch information
yutanagano committed Aug 20, 2024
1 parent 2360dd6 commit dc12a66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sceptr/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def __init__(self, representation_array: ndarray, compartment_mask: ndarray) ->
self.representation_array = representation_array
self.compartment_mask = compartment_mask

def __repr__(self) -> str:
return f"ResidueRepresentations[num_tcrs: {self.representation_array.shape[0]}, rep_dim: {self.representation_array.shape[2]}]"


class Sceptr:
"""
Expand Down
14 changes: 14 additions & 0 deletions tests/test_residue_representations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import numpy as np
import pytest
from sceptr.model import ResidueRepresentations


def test_repr(res_reps):
assert res_reps.__repr__() == "ResidueRepresentations[num_tcrs: 3, rep_dim: 64]"


@pytest.fixture
def res_reps() -> ResidueRepresentations:
rep_array = np.zeros((3, 10, 64))
comp_mask = np.zeros_like(rep_array, dtype=int)
return ResidueRepresentations(rep_array, comp_mask)

0 comments on commit dc12a66

Please sign in to comment.