def calc_times(): """ Calculates open/close times from miles, using rules described at http://www.rusa.org/octime_alg.html. Expects one URL-encoded argument, the number of miles. """ app.logger.debug("Got a JSON request"); miles = request.args.get('miles', 0, type=int) brevit = acpBrevit(miles) return jsonify(min=brevit[0], max=brevit[1])
def test_range1(self): self.assertEqual( acpBrevit(0), (60,0))
def test_Max(self): self.assertEqual( acpBrevit(200), (353,780))
def test_175(self): self.assertEqual( acpBrevit(175), (309,700))
def test_120(self): self.assertEqual( acpBrevit(120), (212,480))
def test_60(self): self.assertEqual( acpBrevit(60), (106,240))
def test_range1(self): self.assertEqual( acpBrevit(10), (17,40))