예제 #1
0
 def test_scale_stoichiometry(self):
     title = 'A'
     energy = -100.0
     stoichiometry = {'B': 1, 'C': 2}
     calculation = Calculation(title=title,
                               energy=energy,
                               stoichiometry=stoichiometry)
     self.assertEqual(calculation.scale_stoichiometry(2), {'B': 2, 'C': 4})
예제 #2
0
 def test_mul( self ):
     title = 'A'
     energy = -100.0
     stoichiometry = { 'B': 1, 'C': 2 }
     calculation = Calculation( title=title, energy=energy, stoichiometry=stoichiometry )
     calculation.scale_stoichiometry = Mock( return_value={ 'B': 2, 'C': 4 } )
     new_calculation = calculation * 2
     self.assertEqual( title, new_calculation.title )
     self.assertEqual( energy * 2.0, new_calculation.energy )
     self.assertEqual( { 'B': 2, 'C': 4 }, new_calculation.stoichiometry )
     calculation.scale_stoichiometry.assert_called_with( 2 )
예제 #3
0
 def test_mul(self):
     title = 'A'
     energy = -100.0
     stoichiometry = {'B': 1, 'C': 2}
     calculation = Calculation(title=title,
                               energy=energy,
                               stoichiometry=stoichiometry)
     calculation.scale_stoichiometry = Mock(return_value={'B': 2, 'C': 4})
     new_calculation = calculation * 2
     self.assertEqual(title, new_calculation.title)
     self.assertEqual(energy * 2.0, new_calculation.energy)
     self.assertEqual({'B': 2, 'C': 4}, new_calculation.stoichiometry)
     calculation.scale_stoichiometry.assert_called_with(2)
예제 #4
0
 def test_scale_stoichiometry( self ):
     title = 'A'
     energy = -100.0
     stoichiometry = { 'B': 1, 'C': 2 }
     calculation = Calculation( title=title, energy=energy, stoichiometry=stoichiometry )
     self.assertEqual( calculation.scale_stoichiometry( 2 ), { 'B': 2, 'C': 4 } )