Ejemplo n.º 1
0
 def test_retrieve(self):
     """Test to retrieve the proper message from a catalog."""
     catalog = Catalog("test")
     catalog.read_YAML(SIMPLE_DOC)
     self.assertEqual(catalog.retrieve("view"), "Affichage")
     self.assertEqual(catalog.retrieve("connection.error"),
             "Connexion impossible")
     self.assertEqual(catalog.retrieve("greeting", name="Jeanne"),
             "Bienvenue, Jeanne !")
Ejemplo n.º 2
0
 def test_retrieve_plural(self):
     """Test to retrieve the proper message using count indicators."""
     catalog = Catalog("test")
     catalog.read_YAML(PLURAL_DOC)
     self.assertEqual(catalog.retrieve("emails", 0), "You have no email")
     self.assertEqual(catalog.retrieve("emails", 1),
             "Well, you have one email")
     self.assertEqual(catalog.retrieve("emails", 2),
             "You only have 2 emails")
     self.assertEqual(catalog.retrieve("emails", 3),
             "You only have 3 emails")
     self.assertEqual(catalog.retrieve("emails", 5),
             "Wow, you have 5 emails")
     self.assertEqual(catalog.retrieve("emails", 6),
             "Wow, you have 6 emails")