-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from Albericvgn/fane
DJ KHALEEEED
- Loading branch information
Showing
2 changed files
with
58 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import unittest | ||
import numpy as np | ||
import sys | ||
import os | ||
|
||
try: | ||
current_dir = os.path.dirname(os.path.abspath(__file__)) | ||
except NameError: | ||
current_dir = os.path.dirname(os.path.abspath(sys.argv[0])) | ||
src_path = os.path.join(current_dir, '..', 'src') | ||
sys.path.insert(0, src_path) | ||
|
||
from chembalancer.chembalancer import balance_chemical_equation | ||
|
||
class TestBalanceChemicalEquation: | ||
@pytest.fixture(autouse=True) | ||
def setup_method(self): | ||
pass | ||
|
||
def test_combustion_of_methane(self): | ||
# Reactants and products | ||
reactant_smiles = ['CH4', 'O2'] | ||
product_smiles = ['CO2', 'H2O'] | ||
|
||
# Call the function to test | ||
try: | ||
reactant_data, product_data = balance_chemical_equation(reactant_smiles, product_smiles) | ||
except ValueError as e: | ||
assert "Failed to solve the balance equation." in str(e) | ||
return | ||
|
||
# Assertions | ||
expected_reactant_data = [(1, 'CH4'), (2, 'O2')] | ||
expected_product_data = [(1, 'CO2'), (2, 'H2O')] | ||
|
||
assert reactant_data == expected_reactant_data | ||
assert product_data == expected_product_data |