Skip to content

Commit

Permalink
add repr to LomapAtomMapper
Browse files Browse the repository at this point in the history
now describes the settings of the Mapper object clearly
  • Loading branch information
richardjgowers committed Nov 10, 2023
1 parent 296f416 commit 0ee923f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lomap/gufe_bindings/mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def __init__(self, *, time: int = 20, threed: bool = True,
self.seed = seed
self.shift = shift

def __repr__(self):
return (f"<LomapAtomMapper (time={self.time}, threed={self.threed}, "
f"max3d={self.max3d}, element_change={self.element_change}, "
f"seed='{self.seed}', shift={self.shift})>")

@due.dcite(Doi("https://doi.org/10.1007/s10822-013-9678-y"), description="LOMAP")
def suggest_mappings(self,
componentA: gufe.SmallMoleculeComponent,
Expand Down
13 changes: 13 additions & 0 deletions lomap/tests/test_lomapatommapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from lomap import LomapAtomMapper


def test_repr():
m = LomapAtomMapper()

assert repr(m) == ("<LomapAtomMapper (time=20, threed=True, max3d=1000.0, "
"element_change=True, seed='', shift=True)>")

m = LomapAtomMapper(time=15, seed='c1ccccc1')

assert repr(m) == ("<LomapAtomMapper (time=15, threed=True, max3d=1000.0, "
"element_change=True, seed='c1ccccc1', shift=True)>")

0 comments on commit 0ee923f

Please sign in to comment.