Esempio n. 1
0
 def test_i18n_message_from_dict_source_module(self):
     self.assertEqual(
         fields._dict_to_i18n_message(
             {"id": "modules.x.y", "arguments": {"foo": "bar"}, "source": "module"}
         ),
         types.I18nMessage("modules.x.y", {"foo": "bar"}, "module"),
     )
Esempio n. 2
0
 def test_i18n_message_from_dict_no_source(self):
     self.assertEqual(
         fields._dict_to_i18n_message(
             {"id": "modules.x.y", "arguments": ["s", 12345678, 0.123]}
         ),
         types.I18nMessage("modules.x.y", ["s", 12345678, 0.123]),
     )
Esempio n. 3
0
 def test_i18n_message_from_dict_best_wanted_type_datetime_becomes_timestamp(self):
     # Compatibility for https://www.pivotaltracker.com/story/show/174865394
     # DELETEME when there are no CachedRenderResults from before 2020-10-01
     self.assertEqual(
         fields._dict_to_i18n_message(
             {
                 "id": "py.renderer.execute.types.PromptingError.WrongColumnType.as_quick_fixes.general",
                 "arguments": {
                     "found_type": "text",
                     "best_wanted_type": "datetime",
                 },
             }
         ),
         types.I18nMessage(
             "py.renderer.execute.types.PromptingError.WrongColumnType.as_quick_fixes.general",
             {"found_type": "text", "best_wanted_type": "timestamp"},
             None,
         ),
     )