| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# |
| 3 |
# Copyright (c) 2018, the cclib development team |
| 4 |
# |
| 5 |
# This file is part of cclib (http://cclib.github.io) and is distributed under |
| 6 |
# the terms of the BSD 3-Clause License. |
| 7 |
|
| 8 |
"""Unit tests for specific parser behaviors, such as overriden methods.""" |
| 9 |
|
| 10 |
import unittest |
| 11 |
|
| 12 |
|
| 13 |
class NormalisesymTest(unittest.TestCase): |
| 14 |
|
| 15 |
# Not needed: DALTON, MOPAC, NWChem, ORCA, Psi, QChem |
| 16 |
|
| 17 |
def test_normalisesym_adf(self): |
| 18 |
from cclib.parser.adfparser import ADF |
| 19 |
sym = ADF("dummyfile").normalisesym |
| 20 |
labels = ['A', 's', 'A1', 'A1.g', 'Sigma', 'Pi', 'Delta', 'Phi', 'Sigma.g', 'A.g', 'AA', 'AAA', 'EE1', 'EEE1'] |
| 21 |
ref = ['A', 's', 'A1', 'A1g', 'sigma', 'pi', 'delta', 'phi', 'sigma.g', 'Ag', "A'", 'A"', "E1'", 'E1"'] |
| 22 |
self.assertEqual(list(map(sym, labels)), ref) |
| 23 |
|
| 24 |
def test_normalisesym_gamess(self): |
| 25 |
from cclib.parser.gamessparser import GAMESS |
| 26 |
sym = GAMESS("dummyfile").normalisesym |
| 27 |
labels = ['A', 'A1', 'A1G', "A'", "A''", "AG"] |
| 28 |
ref = ['A', 'A1', 'A1g', "A'", 'A"', 'Ag'] |
| 29 |
self.assertEqual(list(map(sym, labels)), ref) |
| 30 |
|
| 31 |
def test_normalisesym_gamessuk(self): |
| 32 |
from cclib.parser.gamessukparser import GAMESSUK |
| 33 |
sym = GAMESSUK("dummyfile.txt").normalisesym |
| 34 |
labels = ['a', 'a1', 'ag', "a'", 'a"', "a''", "a1''", 'a1"', "e1+", "e1-"] |
| 35 |
ref = ['A', 'A1', 'Ag', "A'", 'A"', 'A"', 'A1"', 'A1"', 'E1', 'E1'] |
| 36 |
self.assertEqual(list(map(sym, labels)), ref) |
| 37 |
|
| 38 |
def test_normalisesym_gaussian(self): |
| 39 |
from cclib.parser.gaussianparser import Gaussian |
| 40 |
sym = Gaussian("dummyfile").normalisesym |
| 41 |
labels = ['A1', 'AG', 'A1G', "SG", "PI", "PHI", "DLTA", 'DLTU', 'SGG'] |
| 42 |
ref = ['A1', 'Ag', 'A1g', 'sigma', 'pi', 'phi', 'delta', 'delta.u', 'sigma.g'] |
| 43 |
self.assertEqual(list(map(sym, labels)), ref) |
| 44 |
|
| 45 |
def test_normalisesym_jaguar(self): |
| 46 |
from cclib.parser.jaguarparser import Jaguar |
| 47 |
sym = Jaguar("dummyfile").normalisesym |
| 48 |
labels = ['A', 'A1', 'Ag', 'Ap', 'App', "A1p", "A1pp", "E1pp/Ap"] |
| 49 |
ref = ['A', 'A1', 'Ag', "A'", 'A"', "A1'", 'A1"', 'E1"'] |
| 50 |
self.assertEqual(list(map(sym, labels)), ref) |
| 51 |
|
| 52 |
def test_normalisesym_molpro(self): |
| 53 |
from cclib.parser.molproparser import Molpro |
| 54 |
sym = Molpro("dummyfile").normalisesym |
| 55 |
labels = ["A`", "A``"] |
| 56 |
ref = ["A'", "A''"] |
| 57 |
self.assertEqual(list(map(sym, labels)), ref) |
| 58 |
|
| 59 |
|
| 60 |
if __name__ == "__main__": |
| 61 |
unittest.main() |