-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add id and comment #110
Add id and comment #110
Changes from all commits
3007f86
3987455
a5a56bf
03af5ea
641aae9
541f319
7c81093
9fba781
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,54 @@ def test_set_qualities_none(self): | |
seq.qualities = None | ||
assert seq.qualities is None | ||
|
||
def test_set_id(self): | ||
seq = SequenceRecord("name", "A", "=") | ||
with pytest.raises(AttributeError): | ||
seq.id = "Obi-Wan" | ||
|
||
def test_set_comment(self): | ||
seq = SequenceRecord("name", "A", "=") | ||
with pytest.raises(AttributeError): | ||
seq.comment = "Hello there!" | ||
|
||
@pytest.mark.parametrize( | ||
["record", "expected"], | ||
[ | ||
(SequenceRecord("name", "A", "="), None), | ||
(SequenceRecord("name ", "A", "="), None), | ||
(SequenceRecord("name ", "A", "="), None), | ||
(SequenceRecord("name", "A", "="), None), | ||
(SequenceRecord("AotC I hate sand!", "A", "="), "I hate sand!"), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I got the Star Wars reference, but didn’t know the song (and now it’ll be stuck in my head for the rest of the day ...) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well you could always listen to "Last jedi knight" by the same musician to get it out of your head again ;-). |
||
( | ||
SequenceRecord("Givemesome space", "A", "="), | ||
"space", | ||
), | ||
], | ||
) | ||
def test_get_comment(self, record, expected): | ||
assert record.comment == expected | ||
|
||
@pytest.mark.parametrize( | ||
["record", "expected"], | ||
[ | ||
(SequenceRecord("name", "A", "="), "name"), | ||
(SequenceRecord("name ", "A", "="), "name"), | ||
(SequenceRecord("name ", "A", "="), "name"), | ||
(SequenceRecord("name", "A", "="), "name"), | ||
(SequenceRecord("AotC I hate sand!", "A", "="), "AotC"), | ||
], | ||
) | ||
def test_get_id(self, record, expected): | ||
assert record.id == expected | ||
|
||
def test_reset_id_and_comment_on_name_update(self): | ||
record = SequenceRecord("Obi-Wan: don't try it!", "", "") | ||
assert record.id == "Obi-Wan:" | ||
assert record.comment == "don't try it!" | ||
record.name = "Anakin: you underestimate my power!" | ||
assert record.id == "Anakin:" | ||
assert record.comment == "you underestimate my power!" | ||
|
||
|
||
def test_legacy_sequence(): | ||
from dnaio import Sequence | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, this assumes that there’s only one whitespace between the id and the comment. I’d assume this is true most of the time, but I think we need to be a bit more defensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally, a use for strspn!