test_utils.py 479 Bytes
Newer Older
1
import unittest
2
import torch
3
import torchani
Jinze Xue's avatar
Jinze Xue committed
4
from torchani.testing import TestCase
5
6


Jinze Xue's avatar
Jinze Xue committed
7
class TestUtils(TestCase):
8
9

    def testChemicalSymbolsToInts(self):
10
        str2i = torchani.utils.ChemicalSymbolsToInts(['A', 'B', 'C', 'D', 'E', 'F'])
11
12
13
        self.assertEqual(len(str2i), 6)
        self.assertListEqual(str2i('BACCC').tolist(), [1, 0, 2, 2, 2])

14
15
16
    def testHessianJIT(self):
        torch.jit.script(torchani.utils.hessian)

17
18
19

if __name__ == '__main__':
    unittest.main()