Skip to content

Commit

Permalink
Tests update.
Browse files Browse the repository at this point in the history
  • Loading branch information
smelandr committed Oct 23, 2017
1 parent 4c98b0e commit 97fc626
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/test_api_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import collections
import pytest

from nmrstarlib import nmrstarlib
import nmrstarlib


@pytest.mark.parametrize("test_input,test_output,amino_acids,atoms,amino_acids_and_atoms", [
Expand Down
31 changes: 26 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import shutil
import pytest

from nmrstarlib import nmrstarlib
import nmrstarlib


def teardown_module(module):
Expand Down Expand Up @@ -86,13 +86,34 @@ def teardown_module(module):
("tests/example_data/NMRSTAR2/tmp/json/dir/starfiles_files_json.tar.bz2", "tests/example_data/NMRSTAR2/tmp/nmrstar/tarbz2/starfiles_nmrstar.tar.bz2", "json", "nmrstar")
])
def test_convert_command(from_path, to_path, from_format, to_format):
command = "python -m nmrstarlib convert {} {} --from_format={} --to_format={}".format(from_path,
to_path,
from_format,
to_format)
command = "python -m nmrstarlib convert {} {} --from_format={} --to_format={}".format(from_path, to_path, from_format, to_format)
assert os.system(command) == 0

starfile_generator = nmrstarlib.read_files(to_path)
starfiles_list = list(starfile_generator)
starfiles_ids_set = set(sf.bmrbid for sf in starfiles_list)
assert starfiles_ids_set.issubset({"15000", "18569"})


@pytest.mark.parametrize("from_path,amino_acids,atoms,nmrstar_version", [
("tests/example_data/NMRSTAR3/bmr18569.str", None, None, "3"),
("tests/example_data/NMRSTAR3/bmr18569.str", "SER,MET", None, "3"),
("tests/example_data/NMRSTAR3/bmr18569.str", None, "CA,CB", "3"),
("tests/example_data/NMRSTAR3/bmr18569.str", "SER,MET", "CA,CB", "3"),
("tests/example_data/NMRSTAR2/bmr18569.str", None, None, "2"),
("tests/example_data/NMRSTAR2/bmr18569.str", "SER,MET", None, "2"),
("tests/example_data/NMRSTAR2/bmr18569.str", None, "CA,CB", "2"),
("tests/example_data/NMRSTAR2/bmr18569.str", "SER,MET", "CA,CB", "2")
])
def test_csview_command(from_path, amino_acids, atoms, nmrstar_version):

if amino_acids == None and atoms == None:
command = "python3 -m nmrstarlib csview {} --nmrstar_version={}".format(from_path, nmrstar_version)
elif amino_acids == None and atoms != None:
command = "python3 -m nmrstarlib csview {} --atoms={} --nmrstar_version={}".format(from_path, atoms, nmrstar_version)
elif atoms == None and amino_acids != None:
command = "python3 -m nmrstarlib csview {} --amino_acids={} --nmrstar_version={}".format(from_path, amino_acids, nmrstar_version)
else:
command = "python3 -m nmrstarlib csview {} --amino_acids={} --atoms={} --nmrstar_version={}".format(from_path, amino_acids, atoms, nmrstar_version)

assert os.system(command) == 0
2 changes: 1 addition & 1 deletion tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import shutil
import pytest

from nmrstarlib import nmrstarlib
import nmrstarlib
from nmrstarlib.converter import Converter
from nmrstarlib.translator import StarFileToStarFile

Expand Down
2 changes: 1 addition & 1 deletion tests/test_reading.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from nmrstarlib import nmrstarlib
import nmrstarlib


@pytest.mark.parametrize("source", [
Expand Down

0 comments on commit 97fc626

Please sign in to comment.