@@ -155,7 +155,10 @@ def test_scientific_notation(self):
155
155
assert rxn == Reaction .from_str (str (rxn ))
156
156
157
157
rxn2 = Reaction .from_str ("FePO4 + 20 CO -> 1e1 O2 + Fe1P1O4 + 20 C" )
158
- assert str (rxn2 ) == "20 CO -> 20 C + 10 O2"
158
+ rxn2str = str (rxn2 )
159
+ assert rxn2str .startswith ("20 CO ->" )
160
+ assert "20 C" in rxn2str
161
+ assert "10 O2" in rxn2str
159
162
160
163
def test_equals (self ):
161
164
reactants = [Composition ("Fe" ), Composition ("O2" )]
@@ -293,7 +296,10 @@ def setup_method(self) -> None:
293
296
self .rxn = BalancedReaction (rct , prod )
294
297
295
298
def test_init (self ):
296
- assert str (self .rxn ) == "24 Li + Na2S + 3 K2SO4 -> 2 KNaS + 2 K2S + 12 Li2O"
299
+ rxnstr = str (self .rxn )
300
+ reactants , products = rxnstr .split (" -> " )
301
+ assert set (reactants .split (" + " )) == {"24 Li" , "Na2S" , "3 K2SO4" }
302
+ assert set (products .split (" + " )) == {"2 KNaS" , "2 K2S" , "12 Li2O" }
297
303
298
304
# Test unbalanced exception
299
305
rct = {"K2SO4" : 1 , "Na2S" : 1 , "Li" : 24 }
@@ -329,9 +335,6 @@ def test_remove_spectator_species(self):
329
335
330
336
assert "Na" not in rxn .all_comp
331
337
332
- def test_hash (self ):
333
- assert hash (self .rxn ) == 4774511606373046513
334
-
335
338
336
339
class TestComputedReaction :
337
340
def setup_method (self ):
0 commit comments