-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathtest_module_editor.py
executable file
·70 lines (51 loc) · 1.89 KB
/
test_module_editor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from unittest import mock
def test_editor_wo_features(monkeypatch):
import subprocess
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
from pydna.dseqrecord import Dseqrecord
argument = Dseqrecord("ggatcc")
editor.ape(argument)
assert Popen.called
def test_editor_with_feature_label(monkeypatch):
import subprocess
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
from pydna.dseqrecord import Dseqrecord
argument = Dseqrecord("ggatcc")
argument.add_feature(2, 4, label="lbl")
editor.ape(argument)
assert Popen.called
def test_editor_with_feature_note(monkeypatch):
import subprocess
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
from pydna.dseqrecord import Dseqrecord
argument = Dseqrecord("ggatcc")
argument.add_feature(2, 4, note="nte")
del argument.features[0].qualifiers["label"]
editor.ape(argument)
assert Popen.called
def test_editor_with_feature_wo_label_and_note(monkeypatch):
import subprocess
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
from pydna.dseqrecord import Dseqrecord
argument = Dseqrecord("ggatcc")
argument.add_feature(2, 4)
del argument.features[0].qualifiers["label"]
editor.ape(argument)
assert Popen.called
if __name__ == "__main__":
pytest.main([__file__, "-x", "-vv", "-s"])