mirror of
https://github.com/biopython/biopython.git
synced 2025-10-20 13:43:47 +08:00
@ -1409,6 +1409,7 @@ class SeqRecord:
|
||||
elif annotations:
|
||||
# Copy the old annotations,
|
||||
answer.annotations = self.annotations.copy()
|
||||
if self._per_letter_annotations is not None:
|
||||
if isinstance(letter_annotations, dict):
|
||||
answer.letter_annotations = letter_annotations
|
||||
elif letter_annotations:
|
||||
@ -1519,6 +1520,7 @@ class SeqRecord:
|
||||
answer.annotations = self.annotations.copy()
|
||||
# Set/update to protein:
|
||||
answer.annotations["molecule_type"] = "protein"
|
||||
if self._per_letter_annotations is not None:
|
||||
if isinstance(letter_annotations, dict):
|
||||
answer.letter_annotations = letter_annotations
|
||||
elif letter_annotations:
|
||||
|
@ -535,6 +535,18 @@ class SeqRecordMethodsMore(unittest.TestCase):
|
||||
)
|
||||
self.assertFalse(t.letter_annotations)
|
||||
|
||||
def test_no_side_effects(self):
|
||||
# See issue #5015
|
||||
a = SeqRecord(Seq("AA"))
|
||||
self.assertIsNone(a._per_letter_annotations)
|
||||
a.reverse_complement()
|
||||
self.assertIsNone(a._per_letter_annotations)
|
||||
|
||||
a = SeqRecord(Seq("AA"))
|
||||
self.assertIsNone(a._per_letter_annotations)
|
||||
a.translate()
|
||||
self.assertIsNone(a._per_letter_annotations)
|
||||
|
||||
def test_lt_exception(self):
|
||||
def lt():
|
||||
return SeqRecord(Seq("A")) < SeqRecord(Seq("A"))
|
||||
|
Reference in New Issue
Block a user