Commit c3c18bd0 authored by Lukas Pravda's avatar Lukas Pravda
Browse files

add more tests

parent 0673003f
......@@ -2,6 +2,7 @@
"""
import pytest
from pdbeccdutils.core import ccd_reader
from pdbeccdutils.core.fragment_library import FragmentLibrary
from pdbeccdutils.tests.tst_utilities import supply_list_of_sample_cifs
sample_ccd_cifs = supply_list_of_sample_cifs()
......@@ -17,3 +18,8 @@ def component(request):
assert reader.warnings == []
return c
@pytest.fixture(scope="session")
def library():
return FragmentLibrary()
"""Test fragment library functionality
"""
import os
import xml.etree.ElementTree as ET
from pdbeccdutils.core.fragment_library import FragmentLibrary
from pdbeccdutils.helpers.drawing import svg_namespace
def test__img_crated(library, tmpdir):
file_path = str(tmpdir.join('library.svg'))
library.to_image(file_path)
assert os.path.isfile(file_path)
xml = ET.parse(file_path)
assert len(xml.findall('svg:rect', svg_namespace)) > 100
def test_img_png_created(library, tmpdir):
file_path = str(tmpdir.join('library.png'))
library.to_image(file_path, source="PDBe")
assert os.path.isfile(file_path)
def test_generate_conformers(library):
library.generate_conformers()
for entry in library.library.values():
assert entry.mol.GetConformers()
\ No newline at end of file
......@@ -2,6 +2,7 @@ import pytest
from rdkit import Chem
from pdbeccdutils.core import ccd_reader
from pdbeccdutils.core.models import ScaffoldingMethod
from pdbeccdutils.tests.tst_utilities import cif_filename
test_inputs = [
......@@ -41,3 +42,13 @@ class TestScaffold:
assert result[0].GetNumAtoms() == 0
assert not component.scaffolds
@staticmethod
@pytest.mark.parametrize(
"scaffold_type", [ScaffoldingMethod.MurckoGeneric, ScaffoldingMethod.Brics]
)
def test_scaffolds(scaffold_type):
c = ccd_reader.read_pdb_cif_file(cif_filename("NAG")).component
c.get_scaffolds(scaffold_type)
assert len(c.scaffolds) > 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment