def test_subtraction():
    value_one = grams('5.00')
    value_two = grams('2.61x10^0')
    value_three = grams('6.57x10^-1')
    actual = value_one - value_two - value_three
    expected = grams('1.73x10^0')
    assert expected == actual
Esempio n. 2
0
def test_composition_NaHCO3():
    actual = composition('NaHCO3')
    expected = Component(1, 'Na', grams('0.2737'), Decimal('27.37'))
    assert expected == actual[0]
    expected = Component(1, 'H', grams('0.01200'), Decimal('1.20'))
    assert expected == actual[1]
    expected = Component(1, 'C', grams('0.1430'), Decimal('14.30'))
    assert expected == actual[2]
    expected = Component(3, 'O', grams('0.5714'), Decimal('57.14'))
    assert expected == actual[3]
Esempio n. 3
0
def test_formula_of_C_H_O():
    elements = [('C', grams('2.61')), ('H', grams('0.658')),
                ('O', grams('1.73'))]
    actual = formula_from_mass(elements)
    expected = "C2H6O"
    assert expected == actual
Esempio n. 4
0
def test_amount_of_iron_in_limonite():
    actual = composition('Fe2O3*[3/2]H2O', grams(Scinot('1.0000x10^6')))
    expected = Component(2, 'Fe', grams(Scinot('5.9820x10^5')),
                         Decimal('59.82'))
    assert expected == actual[0]
Esempio n. 5
0
def test_composition_CO2():
    actual = composition('CO2')
    expected = Component(1, 'C', grams('0.2729'), Decimal('27.29'))
    assert expected == actual[0]
    expected = Component(2, 'O', grams('0.7271'), Decimal('72.71'))
    assert expected == actual[1]
Esempio n. 6
0
def test_molecules_in_1gram_H2O2():
    actual = molecules_in_mass('H2O2', grams('1.00'))
    expected = Measurement(Scinot('1.77x10^22'), 'atoms')
    assert expected == actual
Esempio n. 7
0
def test_molarity_for_20g_of_K2CrO4_in_1L():
    actual = molarity_of_solution(grams('20.0'), molar_mass('K2CrO4'), liters('1.00'))
    expected = Measurement(Scinot('1.03x10^-1'), MOLES/LITERS)
    assert expected == actual