1
"""
2
test_utils.py
3
"""
4 0
import sys
5 0
import os
6 0
import pytest
7 0
import shutil
8

9
# define location of input files for testing
10 0
mydir = os.path.dirname(os.path.abspath(__file__))
11

12
# import functions to aid testing
13 0
sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers'))
14 0
from helper import *
15

16 0
from quanformer.utils import *
17

18
# -----------------------
19

20 0
def test_convert_extension():
21 0
    convert_extension(
22
        os.path.join(mydir, 'data_tests', 'carbon-222.sdf'),
23
        os.path.join(mydir, 'data_tests', 'carbon-222.mol2'))
24 0
    assert os.path.getsize(os.path.join(mydir, 'data_tests', 'carbon-222.mol2')) == 1320
25 0
    os.remove(os.path.join(mydir, 'data_tests', 'carbon-222.mol2'))
26

27 0
def test_convert_extension_canonical():
28 0
    convert_extension(
29
        os.path.join(mydir, 'data_tests', 'carbon-222.sdf'),
30
        os.path.join(mydir, 'data_tests', 'carbon-222.mol2'),
31
        canonical=True)
32 0
    assert os.path.getsize(os.path.join(mydir, 'data_tests', 'carbon-222.mol2')) == 1321
33 0
    os.remove(os.path.join(mydir, 'data_tests', 'carbon-222.mol2'))
34

35
# test manually without pytest
36 0
if 0:
37
    sys.path.insert(0, '/home/limvt/Documents/quanformer/quanformer')
38
    from utils import *
39
    test_convert_extension_canonical()

Read our documentation on viewing source code .

Loading