1
"""
2
test_basic_plot.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.basic_plot import *
17

18 0
import matplotlib as mpl
19 0
mpl.use("Agg")  # for Mac OS X error of NSInvalidArgumentException on Travis CI
20

21
# -----------------------
22

23

24 0
def test_basic_plot():
25 0
    basic_plot(os.path.join(mydir, 'data_tests', 'survey_confs', 'divrefine-220.sdf'),
26
        tag='QM Psi4 Final Opt. Energy (Har) b3lyp-d3mbj/def2-tzvp',
27
        style='line',
28
        take_relative=True,
29
        har_to_kcal=True)
30 0
    os.remove('output_0.png')
31 0
    os.remove('output_1.png')
32

33 0
def test_combine_files_plot():
34 0
    os.chdir(mydir)
35 0
    combine_files_plot(os.path.join(mydir, 'data_tests', 'survey_confs', 'stitch_ene.in'),
36
        molname='Div_6',
37
        verbose=True,
38
        take_relative=True,
39
        har_to_kcal=True)
40 0
    os.remove('combined.dat')
41 0
    os.remove('combined.png')
42

43

44
# test manually without pytest
45 0
if 0:
46
    sys.path.insert(0, '/home/limvt/Documents/quanformer/quanformer')
47
    from basic_plot import *
48
    test_basic_plot()

Read our documentation on viewing source code .

Loading