Skip to content

Commit

Permalink
Added test case for experimental module
Browse files Browse the repository at this point in the history
  • Loading branch information
glaciapag committed Aug 26, 2023
1 parent 6a275da commit b58faab
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/test_experimental.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import unittest
from pychemkit import EmpiricalFormula
from pychemkit import Element


class TestEmpiricalFormula(unittest.TestCase):

def setUp(self):

# 13.5 g Ca, 10.8 g O, and 0.675 g H
self.em1 = EmpiricalFormula(Ca=13.5, O=10.8, H=0.675)

# 1.52 g of nitrogen (N) and 3.47 g of oxygen (O)
self.em2 = EmpiricalFormula(N=1.52, O=3.47)


def test_empirical_components(self):

self.assertEqual(self.em1.em_components, {Element('Ca'): 1, Element('O'): 2, Element('H'): 2})
self.assertEqual(self.em2.em_components, {Element('N'): 1, Element('O'): 2})


def test_empirical_components(self):

self.assertEqual(self.em1.em_formula, "CaO2H2")
self.assertEqual(self.em2.em_formula, "NO2")

0 comments on commit b58faab

Please sign in to comment.