def test_SolveEquation(self): obj = EquationSolver() obj.RunEquationReduction = False # By forcing 't' into the variable list, no automatic creation of time variables obj.ParseString(""" x=t z=x+1 z(0) = 2. exogenous t=[10.]*20 MaxTime=3""") obj.ExtractVariableList() obj.SetInitialConditions() obj.SolveStep(1) obj.SolveStep(2) obj.SolveStep(3) obj2 = EquationSolver() obj2.RunEquationReduction = False # By forcing 't' into the variable list, no automatic creation of time variables obj2.ParseString(""" x=t z=x+1 z(0) = 2. exogenous t=[10.]*20 MaxTime=3""") obj2.SolveEquation() self.assertEqual(obj.TimeSeries['x'], obj2.TimeSeries['x'])
def test_ParseString_2(self): obj = EquationSolver() if is_python_3: with self.assertWarns(expected_warning=SyntaxWarning): obj.ParseString('x= y = 1')
def test_init2(self): obj = EquationSolver('x=1.') self.assertIn('x', obj.Parser.AllEquations)
def test_ParseString(self): obj = EquationSolver() obj.ParseString('x=1.') self.assertIn('x', obj.Parser.AllEquations)
def test_init(self): obj = EquationSolver() self.assertEqual(0, len(obj.Parser.AllEquations))