當前位置: 首頁>>代碼示例>>Python>>正文


Python Worksheet.items方法代碼示例

本文整理匯總了Python中dirigible.sheet.worksheet.Worksheet.items方法的典型用法代碼示例。如果您正苦於以下問題:Python Worksheet.items方法的具體用法?Python Worksheet.items怎麽用?Python Worksheet.items使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dirigible.sheet.worksheet.Worksheet的用法示例。


在下文中一共展示了Worksheet.items方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_iteration_yields_cells

# 需要導入模塊: from dirigible.sheet.worksheet import Worksheet [as 別名]
# 或者: from dirigible.sheet.worksheet.Worksheet import items [as 別名]
    def test_iteration_yields_cells(self):
        ws = Worksheet()
        ws[1, 1].formula = 'A1'
        ws[2, 4].formula = 'B4'
        ws.name = 'any old name'

        self.assertEquals(ws.items(), [((1, 1), ws[1, 1]), ((2, 4), ws[2, 4])])
開發者ID:bwhmather,項目名稱:dirigible-spreadsheet,代碼行數:9,代碼來源:test_worksheet.py

示例2: test_run_worksheet_should_return_worksheet_with_calculated_values_only

# 需要導入模塊: from dirigible.sheet.worksheet import Worksheet [as 別名]
# 或者: from dirigible.sheet.worksheet.Worksheet import items [as 別名]
    def test_run_worksheet_should_return_worksheet_with_calculated_values_only(self, mock_urllib2):
        self.maxDiff = None

        original_sheet = Worksheet()

        original_sheet.A2.formula = '1'
        original_sheet.A2.value = 1

        original_sheet.C3.formula = '5'
        original_sheet.C3.value = 5

        original_sheet.E4.formula = '=A2 + C3'
        original_sheet.E4.value = 6

        expected_sheet = Worksheet()
        expected_sheet.name = 'Untitled'
        for (col, row), cell in original_sheet.items():
            expected_sheet[col, row].value = cell.value
        foreign_sheet = Sheet()
        foreign_sheet.owner = User(username='skeletor', password='1havTehpowa')
        foreign_sheet.owner.save()
        foreign_sheet.contents_json = worksheet_to_json(original_sheet)
        foreign_sheet.calculate()

        mock_opener = mock_urllib2.build_opener.return_value
        mock_urlopen_file = mock_opener.open.return_value
        mock_urlopen_file.read.return_value = _sheet_to_value_only_json(
            foreign_sheet.name, worksheet_from_json(foreign_sheet.contents_json)
        )

        worksheet_url = 'ws_url/'
        result = run_worksheet(worksheet_url, None, sentinel.private_key)

        target_url = '%sv%s/json/' % (worksheet_url, CURRENT_API_VERSION)
        self.assertCalledOnce(mock_opener.open, target_url, data=urlencode({'dirigible_l337_private_key': sentinel.private_key}))
        self.assertEquals(type(result), Worksheet)
        self.assertEquals(result, expected_sheet)
開發者ID:bwhmather,項目名稱:dirigible-spreadsheet,代碼行數:39,代碼來源:test_calculate.py


注:本文中的dirigible.sheet.worksheet.Worksheet.items方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。