def rulefor_service(langcode): langcode = str(langcode) rule = rulefor(langcode) or None response = {"langcode":langcode, "rule": rule} if rule is None: response["error"] = "Invalid language specified" response = make_response(json.dumps(response)) response.mimetype = 'application/json' return response
def test_basic_5(self): self.assertEqual(rulefor('klingon'), None)
def test_basic_4(self): self.assertEqual(rulefor('is'), 15)
def test_basic_3(self): self.assertEqual(rulefor('lt'), 6)
def test_basic_2(self): self.assertEqual(rulefor('EN'), 1)
def test_basic_1(self): self.assertEqual(rulefor('en'), 1)
def test_basic2(self): self.assertEqual(pluralize(('apple','apples'), 2, rulefor('en')), 'apples')