Skip to content

Commit

Permalink
Fix mock of class method
Browse files Browse the repository at this point in the history
  • Loading branch information
benmwebb committed Sep 19, 2023
1 parent 4193593 commit a8abd43
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modules/mmcif/test/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
def mocked_ihm_from_accession():
"""Prevent ihm.reference.UniProtSequence.from_accession from
accessing the network"""
def mock_from_acc(accession):
return ihm.reference.UniProtSequence(db_code='CSN1_HUMAN',
accession='Q13098',
sequence='someseq')
def mock_from_acc(cls, accession):
return cls(db_code='CSN1_HUMAN', accession='Q13098',
sequence='someseq')

orig_meth = ihm.reference.UniProtSequence.from_accession
try:
ihm.reference.UniProtSequence.from_accession = mock_from_acc
ihm.reference.UniProtSequence.from_accession = classmethod(
mock_from_acc)
yield
finally:
ihm.reference.UniProtSequence.from_accession = orig_meth
Expand Down

0 comments on commit a8abd43

Please sign in to comment.