# Path: molmod/periodic.py
# class AtomInfo(object):
# class PeriodicData(object):
#     def __init__(self):
#         def append_convertor(word):
#     def _add_atom_info(self, atom_info):
#     def __len__(self):
#     def __getitem__(self, index):
#     def iter_numbers(self):
# 
# Path: molmod/isotopes.py
# class Ame2003(object):
# class NubTab03(object):
#     def __init__(self):
#         def add_mass(N, Z, mass):
#     def __init__(self):
#         def add_abundance(A, Z, abundance):
#                 N = int(line[ 5:10])
#                 Z = int(line[10:15])
#                 Z = int(line[0:3])
#                 A = int(line[4:7])


import unittest
from molmod import *
from molmod.periodic import periodic
from molmod.isotopes import ame2003, nubtab03




__all__ = ["DataTestCase"]


class DataTestCase(unittest.TestCase):
    def test_periodic(self):
        # assert that the most important fields have been loaded
        # and that the conversions are done correctly
        self.assertEqual(periodic[1].name, "Hydrogen")
        self.assertEqual(periodic[1].symbol, "H")
        self.assertEqual(periodic[1].number, 1)
        self.assertEqual(periodic[1].row, 1)
        self.assertEqual(periodic[1].col, 1)
        self.assertAlmostEqual(periodic[1].mass, 1.00794*unified, 3)
        self.assertAlmostEqual(periodic[1].density, 0.12411, 3)
        self.assertAlmostEqual(periodic[1].covalent_radius/angstrom, 0.31, 3)
        self.assertAlmostEqual(periodic[1].vdw_radius/angstrom, 1.09, 3)
        self.assertEqual(periodic[1].artificial, False)
        self.assertAlmostEqual(periodic[1].red, 1.0, 3)
        self.assertAlmostEqual(periodic[1].green, 1.0, 3)
        self.assertAlmostEqual(periodic[1].blue, 1.0, 3)

        self.assertEqual(periodic[1], periodic["H"])
        self.assertEqual(periodic[1], periodic["h"])

    def test_ame2003(self):
        self.assertAlmostEqual(ame2003.masses[6][12]/12/unified, 1.0)

# Path: molmod/periodic.py
# class AtomInfo(object):
# class PeriodicData(object):
#     def __init__(self):
#         def append_convertor(word):
#     def _add_atom_info(self, atom_info):
#     def __len__(self):
#     def __getitem__(self, index):
#     def iter_numbers(self):
# 
# Path: molmod/isotopes.py
# class Ame2003(object):
# class NubTab03(object):
#     def __init__(self):
#         def add_mass(N, Z, mass):
#     def __init__(self):
#         def add_abundance(A, Z, abundance):
#                 N = int(line[ 5:10])
#                 Z = int(line[10:15])
#                 Z = int(line[0:3])
#                 A = int(line[4:7])


# Path: molmod/test/test_data.py
import unittest
from molmod import *
from molmod.periodic import periodic
from molmod.isotopes import ame2003, nubtab03





__all__ = ["DataTestCase"]


class DataTestCase(unittest.TestCase):
    def test_periodic(self):
        # assert that the most important fields have been loaded
        # and that the conversions are done correctly
        self.assertEqual(periodic[1].name, "Hydrogen")
        self.assertEqual(periodic[1].symbol, "H")
        self.assertEqual(periodic[1].number, 1)
        self.assertEqual(periodic[1].row, 1)
        self.assertEqual(periodic[1].col, 1)
        self.assertAlmostEqual(periodic[1].mass, 1.00794*unified, 3)
        self.assertAlmostEqual(periodic[1].density, 0.12411, 3)
        self.assertAlmostEqual(periodic[1].covalent_radius/angstrom, 0.31, 3)
        self.assertAlmostEqual(periodic[1].vdw_radius/angstrom, 1.09, 3)
        self.assertEqual(periodic[1].artificial, False)
        self.assertAlmostEqual(periodic[1].red, 1.0, 3)
        self.assertAlmostEqual(periodic[1].green, 1.0, 3)
        self.assertAlmostEqual(periodic[1].blue, 1.0, 3)

        self.assertEqual(periodic[1], periodic["H"])
        self.assertEqual(periodic[1], periodic["h"])

    def test_ame2003(self):
        self.assertAlmostEqual(ame2003.masses[6][12]/12/unified, 1.0)

        self.assertAlmostEqual(ame2003.masses[1][1]/unified, 1.00782503207)