Example #1
0
 def test_success(self):
   num1 = calculator.input1(self.mock_input1)
   oper = calculator.inputop(self.mock_operator)
   num2 = calculator.input2(self.mock_input2)
   ans = calculator.operator(num1,oper,num2)
   final = calculator.output(num1,oper,num2,ans)
   self.assertEqual(final,"1 + 1 = 2")
def graph(text):
    tmptext = entry.get()
    if calc.preview(tmptext)[1] == 1:
        tmptext = calc.preview(tmptext)[0]
        tmptext = '$\displaystyle ' + tmptext + "$"
    else:
        tmptext = calc.operator(tmptext)
        tmptext = calc.latifa(tmptext)
        tmptext = '$\displaystyle ' + tmptext + "$"

    ax.clear()
    ax.text(0.2, 0.4, tmptext, fontsize=24)
    canvas.draw()
Example #3
0
 def test_operator(self):
   self.assertEqual(calculator.operator(1,self.mock_operator(''),1),2)
Example #4
0
 def test_None(self):
   self.assertEqual(calculator.operator(1,'A',1),None)