/
tests.py
95 lines (63 loc) · 1.98 KB
/
tests.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import os
import subprocess
import tempfile
import nbformat
def _notebook_read(path):
"""
Parameters
----------
path: str
path to ipython notebook
Returns
-------
nb: notebook object
errors: list of Exceptions
"""
with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout:
args = [
"jupyter-nbconvert", "--to", "notebook", "--execute",
"--ExecutePreprocessor.timeout=600", "--output", fout.name, path
]
subprocess.check_call(args)
fout.seek(0)
nb = nbformat.read(fout, nbformat.current_nbformat)
errors = [output for cell in nb.cells if "outputs" in cell
for output in cell["outputs"] \
if output.output_type == "error"]
return nb, errors
def test_protein_ligand_complex_notebook():
nb, errors = _notebook_read("protein_ligand_complex_notebook.ipynb")
assert errors == []
def test_bace():
nb, errors = _notebook_read("BACE.ipynb")
assert errors == []
def test_multitask_networks_on_muv():
nb, errors = _notebook_read("Multitask_Networks_on_MUV.ipynb")
assert errors == []
def test_mnist():
nb, errors = _notebook_read("mnist.ipynb")
assert errors == []
def test_solubility():
nb, errors = _notebook_read("solubility.ipynb")
assert errors == []
def test_quantum():
nb, errors = _notebook_read("quantum_machine_gdb1k.ipynb")
assert errors == []
def test_pong():
nb, errors = _notebook_read("pong.ipynb")
assert errors == []
def test_graph_conv():
nb, errors = _notebook_read("graph_convolutional_networks_for_tox21.ipynb")
assert errors == []
def test_tg_mechanics():
nb, errors = _notebook_read("TensorGraph_Mechanics.ipynb")
assert errors == []
def test_seqtoseq_fingerprint():
nb, errors = _notebook_read("seqtoseq_fingerprint.ipynb")
assert errors == []
def test_dataset_preparation():
nb, errors = _notebook_read("dataset_preparation.ipynb")
assert errors == []
def test_uncertainty():
nb, errors = _notebook_read("Uncertainty.ipynb")
assert errors == []