# Path: auxi/tools/chemistry/stoichiometry.py
# class Element(Object):
# class Group:
# class Compound:
# class CompoundVisitor(parsimonious.NodeVisitor):
#     def __init__(self, period, group, atomic_number, symbol, molar_mass):
#     def count(self):
#     def _validate_(self):
#     def __repr__(self):
# def count_with_multiplier(groups, multiplier):
#     def __init__(self, group, multiplier=1, dotted=False):
#     def count(self):
#     def __repr__(self):
#     def __init__(self, group, dottedgroup=None, phase=None):
#     def count(self):
#     def molar_mass(self):
#     def __repr__(self):
#     def visit_compound(self, _, compound):
#     def visit_group(self, _, group):
#     def visit_phase(self, node, _):
#     def visit_dottedgroup(self, _, dottedgroup):
#     def visit_subscriptedgroup(self, _, subscriptedgroup):
#     def visit_subscriptedelement(self, _, subscriptedelement):
#     def visit_element(self, node, _):
#     def visit_number(self, node, _):
#     def generic_visit(self, node, other):
# def parse_compound(string):
# def amount(compound, mass):
# def amounts(masses):
# def amount_fractions(masses):
# def mass(compound, amount):
# def masses(amounts):
# def mass_fractions(amounts):
# def convert_compound(mass, source, target, element):
# def element_mass_fraction(compound, element):
# def element_mass_fractions(compound, elements):
# def elements(compounds):
# def molar_mass(compound=''):
# def stoichiometry_coefficient(compound, element):
# def stoichiometry_coefficients(compound, elements):


import unittest
from auxi.tools.chemistry import stoichiometry as testee
        m_TiO2 = func(m_FeTiO3, 'FeTiO3', 'TiO2', 'Ti')
        self.assertAlmostEqual(m_TiO2, 526.4365876519838)
        self.assertAlmostEqual(m_FeO + m_TiO2, m_FeTiO3)

    def test_element_mass_fraction(self):
        """
        Test whether an element mass fraction is calculated correctly.
        """

        func = testee.element_mass_fraction

        self.assertAlmostEqual(func('FeO', 'Fe'), 0.7773048421310499)
        self.assertAlmostEqual(func('FeO', 'O'), 0.22269515786895014)
        self.assertAlmostEqual(func('FeO', 'Si'), 0.0)
        self.assertAlmostEqual(func('Fe2O3', 'Fe'), 0.699425505453753)
        self.assertAlmostEqual(func('Fe2O3', 'O'), 0.300574494546247)
        self.assertAlmostEqual(func('Fe2O3', 'Mn'), 0.0)
        self.assertAlmostEqual(func('SiO2', 'Si'), 0.4674349206032192)
        self.assertAlmostEqual(func('SiO2', 'O'), 0.5325650793967809)
        self.assertAlmostEqual(func('SiO2', 'Fe'), 0.0)
        self.assertAlmostEqual(func('Ca(OH)2', 'Ca'), 0.5409171324346751)
        self.assertAlmostEqual(func('Ca(OH)2', 'O'), 0.43187532155673136)
        self.assertAlmostEqual(func('Ca(OH)2', 'H'), 0.027207546008593562)
        self.assertAlmostEqual(func('Ca(OH)2', 'Fe'), 0.0)

    def test_element_mass_fractions(self):
        """
        Test whether a list of element mass fraction is calculated correctly.
        """


# Path: auxi/tools/chemistry/stoichiometry.py
# class Element(Object):
# class Group:
# class Compound:
# class CompoundVisitor(parsimonious.NodeVisitor):
#     def __init__(self, period, group, atomic_number, symbol, molar_mass):
#     def count(self):
#     def _validate_(self):
#     def __repr__(self):
# def count_with_multiplier(groups, multiplier):
#     def __init__(self, group, multiplier=1, dotted=False):
#     def count(self):
#     def __repr__(self):
#     def __init__(self, group, dottedgroup=None, phase=None):
#     def count(self):
#     def molar_mass(self):
#     def __repr__(self):
#     def visit_compound(self, _, compound):
#     def visit_group(self, _, group):
#     def visit_phase(self, node, _):
#     def visit_dottedgroup(self, _, dottedgroup):
#     def visit_subscriptedgroup(self, _, subscriptedgroup):
#     def visit_subscriptedelement(self, _, subscriptedelement):
#     def visit_element(self, node, _):
#     def visit_number(self, node, _):
#     def generic_visit(self, node, other):
# def parse_compound(string):
# def amount(compound, mass):
# def amounts(masses):
# def amount_fractions(masses):
# def mass(compound, amount):
# def masses(amounts):
# def mass_fractions(amounts):
# def convert_compound(mass, source, target, element):
# def element_mass_fraction(compound, element):
# def element_mass_fractions(compound, elements):
# def elements(compounds):
# def molar_mass(compound=''):
# def stoichiometry_coefficient(compound, element):
# def stoichiometry_coefficients(compound, elements):


# Path: auxi/tools/chemistry/stoichiometry_test.py
import unittest
from auxi.tools.chemistry import stoichiometry as testee

        m_TiO2 = func(m_FeTiO3, 'FeTiO3', 'TiO2', 'Ti')
        self.assertAlmostEqual(m_TiO2, 526.4365876519838)
        self.assertAlmostEqual(m_FeO + m_TiO2, m_FeTiO3)

    def test_element_mass_fraction(self):
        """
        Test whether an element mass fraction is calculated correctly.
        """

        func = testee.element_mass_fraction

        self.assertAlmostEqual(func('FeO', 'Fe'), 0.7773048421310499)
        self.assertAlmostEqual(func('FeO', 'O'), 0.22269515786895014)
        self.assertAlmostEqual(func('FeO', 'Si'), 0.0)
        self.assertAlmostEqual(func('Fe2O3', 'Fe'), 0.699425505453753)
        self.assertAlmostEqual(func('Fe2O3', 'O'), 0.300574494546247)
        self.assertAlmostEqual(func('Fe2O3', 'Mn'), 0.0)
        self.assertAlmostEqual(func('SiO2', 'Si'), 0.4674349206032192)
        self.assertAlmostEqual(func('SiO2', 'O'), 0.5325650793967809)
        self.assertAlmostEqual(func('SiO2', 'Fe'), 0.0)
        self.assertAlmostEqual(func('Ca(OH)2', 'Ca'), 0.5409171324346751)
        self.assertAlmostEqual(func('Ca(OH)2', 'O'), 0.43187532155673136)
        self.assertAlmostEqual(func('Ca(OH)2', 'H'), 0.027207546008593562)
        self.assertAlmostEqual(func('Ca(OH)2', 'Fe'), 0.0)

    def test_element_mass_fractions(self):
        """
        Test whether a list of element mass fraction is calculated correctly.
        """


        func = testee.element_mass_fractions