# Path: auxi/tools/materialphysicalproperties/idealgas.py
# class BetaT(Model):
# class RhoT(Model):
# class RhoTP(Model):
# class RhoTPx(Model):
#     def __init__(self):
#     def calculate(self, **state):
#     def __init__(self, molar_mass, P):
#     def calculate(self, **state):
#     def plot(self, datasets, path, show=False):
#     def __init__(self, molar_mass):
#     def calculate(self, **state):
#     def __init__(self):
#     def calculate(self, **state):
# 
# Path: auxi/tools/physicalconstants.py
# R = 8.314462618
# 
# Path: auxi/tools/chemistry/stoichiometry.py
# def molar_mass(self):
#     return sum(_element_dictionary_[element].molar_mass*count
#                for element, count in self.count().items())


import unittest
import random
from auxi.tools.materialphysicalproperties import idealgas as testee
from auxi.tools.physicalconstants import R
from auxi.tools.chemistry.stoichiometry import molar_mass as mm
        total = sum(x.values())

        x = {key: x[key]/total for key in x.keys()}

        molar_mass = sum([x[key]*mm(key) for key in x.keys()])

        return x, molar_mass

    def test_create(self):
        """
        Test whether a model is created successfully.
        """
        testee.RhoTPx()

    def test_calculate(self):
        """
        Test whether the property value is calculated successfully.
        """
        model = testee.RhoTPx()

        T = random.uniform(0.0, 3000.0)
        P = random.uniform(1.0, 101325.0*5.0)
        x, mm = self._create_x_and_mm()
        self.assertAlmostEqual(model.calculate(T=T, P=P, x=x), mm*P/R/T/1000.0)
        T = random.uniform(0.0, 3000.0)
        P = random.uniform(1.0, 101325.0*5.0)
        x, mm = self._create_x_and_mm()
        self.assertAlmostEqual(model.calculate(T=T, P=P, x=x), mm*P/R/T/1000.0)
        T = random.uniform(0.0, 3000.0)
        P = random.uniform(1.0, 101325.0*5.0)

# Path: auxi/tools/materialphysicalproperties/idealgas.py
# class BetaT(Model):
# class RhoT(Model):
# class RhoTP(Model):
# class RhoTPx(Model):
#     def __init__(self):
#     def calculate(self, **state):
#     def __init__(self, molar_mass, P):
#     def calculate(self, **state):
#     def plot(self, datasets, path, show=False):
#     def __init__(self, molar_mass):
#     def calculate(self, **state):
#     def __init__(self):
#     def calculate(self, **state):
# 
# Path: auxi/tools/physicalconstants.py
# R = 8.314462618
# 
# Path: auxi/tools/chemistry/stoichiometry.py
# def molar_mass(self):
#     return sum(_element_dictionary_[element].molar_mass*count
#                for element, count in self.count().items())


# Path: auxi/tools/materialphysicalproperties/idealgas_test.py
import unittest
import random
from auxi.tools.materialphysicalproperties import idealgas as testee
from auxi.tools.physicalconstants import R
from auxi.tools.chemistry.stoichiometry import molar_mass as mm

        total = sum(x.values())

        x = {key: x[key]/total for key in x.keys()}

        molar_mass = sum([x[key]*mm(key) for key in x.keys()])

        return x, molar_mass

    def test_create(self):
        """
        Test whether a model is created successfully.
        """
        testee.RhoTPx()

    def test_calculate(self):
        """
        Test whether the property value is calculated successfully.
        """
        model = testee.RhoTPx()

        T = random.uniform(0.0, 3000.0)
        P = random.uniform(1.0, 101325.0*5.0)
        x, mm = self._create_x_and_mm()
        self.assertAlmostEqual(model.calculate(T=T, P=P, x=x), mm*P/R/T/1000.0)
        T = random.uniform(0.0, 3000.0)
        P = random.uniform(1.0, 101325.0*5.0)
        x, mm = self._create_x_and_mm()
        self.assertAlmostEqual(model.calculate(T=T, P=P, x=x), mm*P/R/T/1000.0)
        T = random.uniform(0.0, 3000.0)
        P = random.uniform(1.0, 101325.0*5.0)

        x, mm = self._create_x_and_mm()