MCPcopy
hub / github.com/burnash/gspread / test_format

Method test_format

tests/worksheet_test.py:1569–1600  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1567
1568 @pytest.mark.vcr()
1569 def test_format(self):
1570 cell_format = {
1571 "backgroundColor": {"green": 1, "blue": 1},
1572 "horizontalAlignment": "CENTER",
1573 "textFormat": {
1574 "foregroundColor": {
1575 "red": 1,
1576 "green": 1,
1577 },
1578 "fontSize": 12,
1579 "bold": True,
1580 },
1581 }
1582 self.maxDiff = None
1583 self.sheet.format("A2:B2", cell_format)
1584
1585 data = self.spreadsheet._spreadsheets_get(
1586 {
1587 "includeGridData": False,
1588 "ranges": ["Sheet1!A2"],
1589 "fields": "sheets.data.rowData.values.userEnteredFormat",
1590 }
1591 )
1592
1593 uef = data["sheets"][0]["data"][0]["rowData"][0]["values"][0][
1594 "userEnteredFormat"
1595 ]
1596
1597 del uef["backgroundColorStyle"]
1598 del uef["textFormat"]["foregroundColorStyle"]
1599
1600 self.assertEqual(uef, cell_format)
1601
1602 @pytest.mark.vcr()
1603 def test_reorder_worksheets(self):

Callers

nothing calls this directly

Calls 2

formatMethod · 0.80
_spreadsheets_getMethod · 0.80

Tested by

no test coverage detected