def test_render_error_to_thrift(self): self.assertEqual( types.RenderError( types.I18nMessage("foo", {}), [ types.QuickFix( types.I18nMessage("click"), types.QuickFixAction.PrependStep("filter", {"x": "y"}), ) ], ).to_thrift(), ttypes.RenderError( ttypes.I18nMessage("foo", {}, ttypes.I18nMessageSource()), [ ttypes.QuickFix( ttypes.I18nMessage("click", {}, ttypes.I18nMessageSource()), ttypes.QuickFixAction( prepend_step=ttypes.PrependStepQuickFixAction( "filter", ttypes.RawParams('{"x":"y"}') ) ), ) ], ), )
def test_i18n_message_to_thrift_source_none(self): self.assertEqual( types.I18nMessage( "modules.x.y", {"a": "s", "b": 12345678, "c": 0.123} ).to_thrift(), ttypes.I18nMessage( "modules.x.y", { "a": ttypes.I18nArgument(string_value="s"), "b": ttypes.I18nArgument(i32_value=12345678), "c": ttypes.I18nArgument(double_value=0.123), }, ttypes.I18nMessageSource(), ), )
def test_quick_fix_from_thrift(self): self.assertEqual( types.QuickFix.from_thrift( ttypes.QuickFix( ttypes.I18nMessage("click", {}, ttypes.I18nMessageSource()), ttypes.QuickFixAction( prepend_step=ttypes.PrependStepQuickFixAction( "filter", ttypes.RawParams('{"x":"y"}') ) ), ) ), types.QuickFix( types.I18nMessage("click"), types.QuickFixAction.PrependStep("filter", {"x": "y"}), ), )
def test_i18n_message_from_thrift_source_library(self): self.assertEqual( types.I18nMessage.from_thrift( ttypes.I18nMessage( "modules.x.y", { "a": ttypes.I18nArgument(string_value="s"), "b": ttypes.I18nArgument(i32_value=12345678), "c": ttypes.I18nArgument(double_value=0.123), }, ttypes.I18nMessageSource(library="cjwmodule"), ) ), types.I18nMessage( "modules.x.y", {"a": "s", "b": 12345678, "c": 0.123}, types.I18nMessageSource.Library("cjwmodule"), ), )