Esempio n. 1
0
 def test_from_list(self):
     with self.assertRaises(ValueError):
         coerce_RenderError([{
             "id": "my_id",
             "arguments": {
                 "hello": "there"
             }
         }])
Esempio n. 2
0
 def test_from_dict_without_message(self):
     with self.assertRaises(ValueError):
         coerce_RenderError({
             "id": "my_id",
             "arguments": {
                 "hello": "there"
             }
         })
Esempio n. 3
0
 def test_from_string_with_quick_fix(self):
     self.assertEqual(
         coerce_RenderError(
             {
                 "message": "error",
                 "quickFixes": [
                     dict(
                         text="button text",
                         action="prependModule",
                         args=["converttotext", {"colnames": ["A", "B"]}],
                     )
                 ],
             }
         ),
         RenderError(
             TODO_i18n("error"),
             [
                 QuickFix(
                     TODO_i18n("button text"),
                     QuickFixAction.PrependStep(
                         "converttotext", {"colnames": ["A", "B"]}
                     ),
                 )
             ],
         ),
     )
Esempio n. 4
0
 def test_from_message_3tuple(self):
     self.assertEqual(
         coerce_RenderError(("my_id", {
             "hello": "there"
         }, "cjwmodule")),
         RenderError(I18nMessage("my_id", {"hello": "there"}, "cjwmodule")),
     )
Esempio n. 5
0
 def test_from_message_2tuple(self):
     self.assertEqual(
         coerce_RenderError(("my_id", {
             "hello": "there"
         })),
         RenderError(I18nMessage("my_id", {"hello": "there"}, None)),
     )
Esempio n. 6
0
 def test_from_none(self):
     with self.assertRaises(ValueError):
         coerce_RenderError(None)
Esempio n. 7
0
 def test_from_string(self):
     self.assertEqual(
         coerce_RenderError("some string"),
         RenderError(I18nMessage("TODO_i18n", {"text": "some string"}, None)),
     )
Esempio n. 8
0
 def test_from_dict_without_quick_fixes(self):
     self.assertEqual(
         coerce_RenderError({"message": ("my id", {})}),
         RenderError(I18nMessage("my id", {}, None), []),
     )