コード例 #1
0
 def test68(self):
     list_ = []
     for el in parse('log(8+20-1,2+1)'):
         list_.append(el)
     self.assertEqual(
         list_,
         ['log', '(', 8.0, '+', 20.0, '-', 1.0, ',', 2.0, '+', 1.0, ')'])
コード例 #2
0
 def test78(self):
     list_ = []
     for el in parse('log(pow(10,2),10)'):
         list_.append(el)
     self.assertEqual(
         list_,
         ['log', '(', 'pow', '(', 10.0, ',', 2.0, ')', ',', 10.0, ')'])
コード例 #3
0
 def test79(self):
     list_ = []
     for el in parse('(pow(2,4)-1)-2'):
         list_.append(el)
     self.assertEqual(
         list_,
         ['(', 'pow', '(', 2.0, ',', 4.0, ')', '-', 1.0, ')', '-', 2.0])
コード例 #4
0
 def test82(self):
     list_ = []
     for el in parse('pow(2,4)*pow(2,3)'):
         list_.append(el)
     self.assertEqual(list_, [
         'pow', '(', 2.0, ',', 4.0, ')', '*', 'pow', '(', 2.0, ',', 3.0, ')'
     ])
コード例 #5
0
 def test63(self):
     list_ = []
     for el in parse('(log(8,2)-1)-2'):
         list_.append(el)
     self.assertEqual(
         list_,
         ['(', 'log', '(', 8.0, ',', 2.0, ')', '-', 1.0, ')', '-', 2.0])
コード例 #6
0
 def test57(self):
     list_ = []
     for el in parse('sin(sin(1))+1+sin(1)'):
         list_.append(el)
     self.assertEqual(list_, [
         'sin', '(', 'sin', '(', 1.0, ')', ')', '+', 1.0, '+', 'sin', '(',
         1.0, ')'
     ])
コード例 #7
0
 def test75(self):
     list_ = []
     for el in parse('sin(log10(100)*log10(1000))'):
         list_.append(el)
     self.assertEqual(list_, [
         'sin', '(', 'log10', '(', 100.0, ')', '*', 'log10', '(', 1000.0,
         ')', ')'
     ])
コード例 #8
0
 def test24(self):
     list_ = []
     for el in parse('1+2*4/3+1!=1+2*4/3+2'):
         list_.append(el)
     self.assertEqual(list_, [
         1.0, '+', 2.0, '*', 4.0, '/', 3.0, '+', 1.0, '!=', 1.0, '+', 2.0,
         '*', 4.0, '/', 3.0, '+', 2.0
     ])
コード例 #9
0
 def test67(self):
     list_ = []
     for el in parse('sin(log(8,2)*log(16,2))'):
         list_.append(el)
     self.assertEqual(list_, [
         'sin', '(', 'log', '(', 8.0, ',', 2.0, ')', '*', 'log', '(', 16.0,
         ',', 2.0, ')', ')'
     ])
コード例 #10
0
 def test33(self):
     list_ = []
     for el in parse('(2.0^(pi/pi+e/e+2.0^0.0))^(1.0/3.0)'):
         list_.append(el)
     self.assertEqual(list_, [
         '(', 2.0, '^', '(', 'pi', '/', 'pi', '+', 'e', '/', 'e', '+', 2.0,
         '^', 0.0, ')', ')', '^', '(', 1.0, '/', 3.0, ')'
     ])
コード例 #11
0
 def test60(self):
     list_ = []
     for el in parse('.+1'):
         list_.append(el)
     self.assertEqual(list_, [
         '.',
         '+',
         1.0,
     ])
コード例 #12
0
 def test35(self):  # why there are no parentheses after division in log
     list_ = []
     for el in parse('10*e^0*log10(.4 -5/ -0.1-10) - -abs(-53/10) + -5'):
         list_.append(el)
     self.assertEqual(list_, [
         10.0, '*', 'e', '^', 0.0, '*', 'log10', '(', 0.4, '-', 5.0, '/',
         '-', 0.1, '-', 10.0, ')', '-', '-', 'abs', '(', '-', 53.0, '/',
         10.0, ')', '+', '-', 5.0
     ])
コード例 #13
0
 def test84(self):
     list_ = []
     for el in parse(
             'pow(2.0^(2.0^2.0*2.0^2.0),sin(log10(100)*log10(1000)))'):
         list_.append(el)
     self.assertEqual(list_, [
         'pow', '(', 2.0, '^', '(', 2.0, '^', 2.0, '*', 2.0, '^', 2.0, ')',
         ',', 'sin', '(', 'log10', '(', 100.0, ')', '*', 'log10', '(',
         1000.0, ')', ')', ')'
     ])
コード例 #14
0
 def test38(self):
     list_ = []
     for el in parse(
             'sin(e^log(e^e^sin(23.0),45.0) + cos(3.0+log10(e^-e)))'):
         list_.append(el)
     self.assertEqual(list_, [
         'sin', '(', 'e', '^', 'log', '(', 'e', '^', 'e', '^', 'sin', '(',
         23.0, ')', ',', 45.0, ')', '+', 'cos', '(', 3.0, '+', 'log10', '(',
         'e', '^', '-', 'e', ')', ')', ')'
     ])
コード例 #15
0
 def test49(self):
     list_ = []
     for el in parse('((((('):
         list_.append(el)
     self.assertEqual(list_, [
         '(',
         '(',
         '(',
         '(',
         '(',
     ])
コード例 #16
0
 def test36(self):
     list_ = []
     for el in parse(
             'sin(-cos(-sin(3.0)-cos(-sin(-3.0*5.0)-sin(cos(log10(43.0))))+'
             'cos(sin(sin(34.0-2.0^2.0))))--cos(1.0)--cos(0.0)^3.0)'):
         list_.append(el)
     self.assertEqual(list_, [
         'sin', '(', '-', 'cos', '(', '-', 'sin', '(', 3.0, ')', '-', 'cos',
         '(', '-', 'sin', '(', '-', 3.0, '*', 5.0, ')', '-', 'sin', '(',
         'cos', '(', 'log10', '(', 43.0, ')', ')', ')', ')', '+', 'cos',
         '(', 'sin', '(', 'sin', '(', 34.0, '-', 2.0, '^', 2.0, ')', ')',
         ')', ')', '-', '-', 'cos', '(', 1.0, ')', '-', '-', 'cos', '(',
         0.0, ')', '^', 3.0, ')'
     ])
コード例 #17
0
 def test13(self):
     list_ = []
     for el in parse('sin(pi/2)'):
         list_.append(el)
     self.assertEqual(list_, ['sin', '(', 'pi', '/', 2.0, ')'])
コード例 #18
0
 def test12(self):
     list_ = []
     for el in parse('log(e)'):
         list_.append(el)
     self.assertEqual(list_, ['log', '(', 'e', ')'])
コード例 #19
0
 def test1(self):
     list_ = []
     for el in parse('-13'):
         list_.append(el)
     self.assertEqual(list_, ['-', 13.0])
コード例 #20
0
 def test10(self):
     list_ = []
     for el in parse('100/3%2^2'):
         list_.append(el)
     self.assertEqual(list_, [100.0, '/', 3.0, '%', 2.0, '^', 2.0])
コード例 #21
0
 def test11(self):
     list_ = []
     for el in parse('pi+e'):
         list_.append(el)
     self.assertEqual(list_, ['pi', '+', 'e'])
コード例 #22
0
 def test70(self):
     list_ = []
     for el in parse('log(100,10)'):
         list_.append(el)
     self.assertEqual(list_, ['log', '(', 100.0, ',', 10.0, ')'])
コード例 #23
0
 def test64(self):
     list_ = []
     for el in parse('-log(8,2)'):
         list_.append(el)
     self.assertEqual(list_, ['-', 'log', '(', 8.0, ',', 2.0, ')'])
コード例 #24
0
 def test80(self):
     list_ = []
     for el in parse('-pow(2,4)'):
         list_.append(el)
     self.assertEqual(list_, ['-', 'pow', '(', 2.0, ',', 4.0, ')'])
コード例 #25
0
 def test73(self):
     list_ = []
     for el in parse('log10(100)-1'):
         list_.append(el)
     self.assertEqual(list_, ['log10', '(', 100.0, ')', '-', 1.0])
コード例 #26
0
 def test14(self):
     list_ = []
     for el in parse('log10(100)'):
         list_.append(el)
     self.assertEqual(list_, ['log10', '(', 100.0, ')'])
コード例 #27
0
 def test76(self):
     list_ = []
     for el in parse('log10(800/2/4)'):
         list_.append(el)
     self.assertEqual(list_, ['log10', '(', 800.0, '/', 2.0, '/', 4.0, ')'])
コード例 #28
0
 def test8(self):
     list_ = []
     for el in parse('10^(2+1)'):
         list_.append(el)
     self.assertEqual(list_, [10.0, '^', '(', 2.0, '+', 1.0, ')'])
コード例 #29
0
 def test15(self):
     list_ = []
     for el in parse('sin(pi/2)*111*6'):
         list_.append(el)
     self.assertEqual(
         list_, ['sin', '(', 'pi', '/', 2.0, ')', '*', 111.0, '*', 6.0])
コード例 #30
0
 def test62(self):
     list_ = []
     for el in parse('log(2.7)'):
         list_.append(el)
     self.assertEqual(list_, ['log', '(', 2.7, ')'])