test_variables.py 812 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import unittest

from tests.parser import TestParser, run_expressions
from sympy import Symbol, symbols


class TestVariables(unittest.TestCase):

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_addition(self):
16 17 18 19
        expressions = [('5 + 5', 5 + 5)]
        run_expressions(expressions)

    def test_addition_of_one_term(self):
20
        a = Symbol('a')
21
        expressions = [('a + 5', 5 + a)]
22 23 24 25
        run_expressions(expressions)

    def test_addition_of_two_terms(self):
        a, b = symbols('a,b')
26
        expressions = [('4*a + 5*b', 4*a + 5*b)]
27 28 29 30 31 32
        run_expressions(expressions)

    #def test_short_addition_of_two_terms(self):
    #    a, b = symbols('a,b')
    #    expressions = [('4a + 5b', 4.0*a + 5.0*b)]
    #    run_expressions(expressions, verbose=1)