Ejemplo n.º 1
0
def main():
    scientificcalc = ScientificCalc()
    angle = float(sys.argv[1])
    print(scientificcalc.calculate_cos(angle))
 def test_type_exception(self):
     scientificcalc = ScientificCalc()
     self.assertRaises(TypeError, scientificcalc.calculate_cos('angle'))
 def test_float_angle_values(self):
     scientificcalc = ScientificCalc()
     self.assertEqual(0.6090559761063562, scientificcalc.calculate_cos(30.5))
 def test_negative_angle_values(self):
     scientificcalc = ScientificCalc()
     self.assertEqual(-0.7596879128588213, scientificcalc.calculate_cos(-15))
 def test_positive_angle_values(self):
     scientificcalc = ScientificCalc()
     self.assertEqual(0.15425144988758405, scientificcalc.calculate_cos(30))
Ejemplo n.º 6
0
def response():
    if request.method == 'POST':
        angle = request.form['angle']
        c1 = ScientificCalc()
        result = c1.calculate_cos(angle)
    return render_template('response.html', value=result)