forked from pydna-group/pydna
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_module_editor.py
executable file
·58 lines (46 loc) · 1.76 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
import subprocess
subprocess # shut up spyder!
from pydna.dseqrecord import Dseqrecord
from unittest import mock
def test_editor_wo_features(monkeypatch):
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
argument = Dseqrecord("ggatcc")
editor.ape(argument)
assert Popen.called
def test_editor_with_feature_label(monkeypatch):
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
argument = Dseqrecord("ggatcc")
argument.add_feature(2,4, label = "lbl")
editor.ape(argument)
assert Popen.called
def test_editor_with_feature_note(monkeypatch):
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
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):
from pydna import editor
Popen = mock.MagicMock(name="subprocess.Popen")
monkeypatch.setattr("subprocess.Popen", Popen)
monkeypatch.setenv("pydna_ape", "path/to/ape")
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__, "-vv", "-s","--cov=pydna","--cov-report=html"])