def index(): form = InputForm() if form.validate_on_submit(): if 'convert_to_f' in request.form.keys(): form.fahrenheit.data = c_to_f(float(form.celsius.data)) else: form.celsius.data = f_to_c(float(form.fahrenheit.data)) return render_template('index.html', form = form )
def test_given1Returns33_8(self): f = c_to_f(1) self.assertEqual(f, 33.8)
def test_given100Returns212(self): f = c_to_f(100) self.assertEqual(f, 212)
def test_given0Returns(self): f = c_to_f(0) self.assertEqual(f, 32)