当前位置: 首页>>代码示例>>Python>>正文


Python Worksheet._console_text方法代码示例

本文整理汇总了Python中dirigible.sheet.worksheet.Worksheet._console_text方法的典型用法代码示例。如果您正苦于以下问题:Python Worksheet._console_text方法的具体用法?Python Worksheet._console_text怎么用?Python Worksheet._console_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dirigible.sheet.worksheet.Worksheet的用法示例。


在下文中一共展示了Worksheet._console_text方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_to_ui_json_meta_data_includes_worksheet_console_text

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import _console_text [as 别名]
 def test_to_ui_json_meta_data_includes_worksheet_console_text(self):
     sheet = Sheet(width=10, height=5)
     worksheet = Worksheet()
     worksheet._console_text = ['error1', 'error2']
     expected = dict(
         width=sheet.width,
         height=sheet.height,
         name='Untitled',
         console_text=worksheet._console_text)
     self.assertEquals(json.loads(sheet_to_ui_json_meta_data(sheet, worksheet)), expected)
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:12,代码来源:test_ui_jsonifier.py

示例2: test_calculate_clears_previous_worksheet_console_text_and_reports_time

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import _console_text [as 别名]
    def test_calculate_clears_previous_worksheet_console_text_and_reports_time(self, mock_time):
        recalc_times = [1.3245, 0]
        def mock_time_fn():
            return recalc_times.pop()
        mock_time.side_effect = mock_time_fn
        worksheet = Worksheet()
        worksheet._console_text = 'previous errors'
        worksheet.add_console_text = Mock()

        calculate(worksheet, sentinel.usercode, sentinel.private_key)
        expected_text = 'Took 1.32s'
        self.assertEquals(worksheet.add_console_text.call_args_list[0],
                          ((expected_text,),{'log_type':'system'})
        )
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:16,代码来源:test_calculate.py

示例3: test_calculate_clears_previous_worksheet_console_text_and_reports_time_when_theres_an_error

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import _console_text [as 别名]
    def test_calculate_clears_previous_worksheet_console_text_and_reports_time_when_theres_an_error(self, mock_time, mock_execute_usercode):
        recalc_times = [1.3245, 0]
        def mock_time_fn():
            return recalc_times.pop()
        mock_time.side_effect = mock_time_fn
        def throw_error(_, __):
            raise Exception('argh')
        mock_execute_usercode.side_effect = throw_error
        worksheet = Worksheet()
        worksheet._console_text = 'previous errors\n'
        worksheet.add_console_text = Mock()

        calculate(worksheet, sentinel.usercode, sentinel.private_key)

        self.assertNotIn('previous errors', worksheet._console_text)
        self.assertEquals(
            worksheet.add_console_text.call_args_list[-1],
            (('Took 1.32s',),{'log_type':'system'}),
        )
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:21,代码来源:test_calculate.py

示例4: test_dependencies_get_put_in_json_as_array_of_arrays

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import _console_text [as 别名]
    def test_dependencies_get_put_in_json_as_array_of_arrays(self):
        self.maxDiff = None

        worksheet = Worksheet()
        worksheet.A1.dependencies = [(1, 2)]
        worksheet._console_text = ""

        worksheet_json = worksheet_to_json(worksheet)

        self.assertEquals(
            json.loads(worksheet_json),
            {
                u"1,1" : {
                    u"formula" : None,
                    u"formatted_value" : u"",
                    u"dependencies" : [[1, 2]],
                },

                u"_console_text": u"",
                u"_usercode_error": None,
            }
        )
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:24,代码来源:test_worksheet.py

示例5: test_worksheet_with_data_to_json

# 需要导入模块: from dirigible.sheet.worksheet import Worksheet [as 别名]
# 或者: from dirigible.sheet.worksheet.Worksheet import _console_text [as 别名]
    def test_worksheet_with_data_to_json(self):
        self.maxDiff = None

        worksheet = Worksheet()

        worksheet.B29.formula = "a constant"
        worksheet.B29.value = 56
        worksheet.B29.formatted_value = "fifty-six"
        worksheet.B29.error = "b0rken"

        worksheet.C29.formula = "another constant"
        worksheet.C29.value = ["value", "is", "a", "list"]
        worksheet.C29.formatted_value = "[the same list]"

        class UnJSONableObject(object):
            def __str__(self):
                return "The result of str-ing the object"
        worksheet.D29.formula = None
        worksheet.D29.value = UnJSONableObject()
        worksheet.D29.formatted_value = "The formatted object"

        worksheet.E29.formula = '=1 + 2'
        worksheet.E29.value = 3
        worksheet.E29.formatted_value = "Three"

        worksheet._console_text = "The console text"
        worksheet._usercode_error = { "message": "The usercode error", "line": 23 }

        worksheet_json = worksheet_to_json(worksheet)

        self.assertEquals(
            json.loads(worksheet_json),
            {
                u"2,29" : {
                    u"formula" : u"a constant",
                    u"value" : 56,
                    u"formatted_value": u"fifty-six",
                    u"error": u"b0rken"
                },

                u"3,29" : {
                    u"formula" : u"another constant",
                    u"value" : [u"value", u"is", u"a", u"list"],
                    u"formatted_value": u"[the same list]"
                },

                u"4,29" : {
                    u"formula" : None,
                    u"formatted_value": u"The formatted object",
                },

                u"5,29" : {
                    u"formula" : u"=1 + 2",
                    u"python_formula" : u"1 + 2",
                    u"value": 3,
                    u"formatted_value": u"Three",
                },

                u"_console_text": u"The console text",
                u"_usercode_error": { u"message": u"The usercode error", u"line": 23 },
            }
        )
开发者ID:bwhmather,项目名称:dirigible-spreadsheet,代码行数:64,代码来源:test_worksheet.py


注:本文中的dirigible.sheet.worksheet.Worksheet._console_text方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。