本文整理匯總了Python中dirigible.sheet.worksheet.Worksheet.clear_values方法的典型用法代碼示例。如果您正苦於以下問題:Python Worksheet.clear_values方法的具體用法?Python Worksheet.clear_values怎麽用?Python Worksheet.clear_values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dirigible.sheet.worksheet.Worksheet
的用法示例。
在下文中一共展示了Worksheet.clear_values方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_clear_values_deletes_cells_with_empty_formula
# 需要導入模塊: from dirigible.sheet.worksheet import Worksheet [as 別名]
# 或者: from dirigible.sheet.worksheet.Worksheet import clear_values [as 別名]
def test_clear_values_deletes_cells_with_empty_formula(self):
ws = Worksheet()
ws[1, 2].formula = ''
ws[1, 2].value = "hello!"
ws[1, 2].formatted_value = "Guten Tag!"
ws.clear_values()
self.assertFalse((1, 2) in ws)
示例2: test_clear_values_clears_values_and_formatted_values_and_errors
# 需要導入模塊: from dirigible.sheet.worksheet import Worksheet [as 別名]
# 或者: from dirigible.sheet.worksheet.Worksheet import clear_values [as 別名]
def test_clear_values_clears_values_and_formatted_values_and_errors(self):
ws = Worksheet()
ws[1, 2].formula = "=1"
ws[1, 2].python_formula = "2"
ws[1, 2].value = "hello!"
ws[1, 2].formatted_value = "Guten Tag!"
ws[1, 2].error = "Goodness Gracious!"
ws[2, 2].python_formula = "1 + 1"
ws.clear_values()
self.assertEquals(ws[1, 2].formula, "=1")
self.assertEquals(ws[1, 2].python_formula, "2")
self.assertEquals(ws[1, 2].value, undefined)
self.assertEquals(ws[1, 2].formatted_value, u'')
self.assertEquals(ws[1, 2].error, None)
self.assertEquals(ws[2, 2].python_formula, '1 + 1')
示例3: test_calculate_clears_previous_worksheet_cell_values_before_executing_usercode
# 需要導入模塊: from dirigible.sheet.worksheet import Worksheet [as 別名]
# 或者: from dirigible.sheet.worksheet.Worksheet import clear_values [as 別名]
def test_calculate_clears_previous_worksheet_cell_values_before_executing_usercode(
self, mock_execute_usercode
):
calls_list = []
worksheet = Worksheet()
worksheet.clear_values = Mock()
worksheet.clear_values.side_effect = lambda *args : calls_list.append('clear values')
mock_execute_usercode.side_effect = lambda *args : calls_list.append('execute usercode')
calculate(worksheet, sentinel.usercode, sentinel.private_key)
self.assertEquals(calls_list, ['clear values', 'execute usercode'])