-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
COMPAT: Updated method call for _Openpyxl22Write.write_cells() for Openpyxl =>2.4.0 #14519 #14539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1940,6 +1940,7 @@ def test_to_excel_styleconverter(self): | |
| self.assertEqual(kw['protection'], protection) | ||
|
|
||
| def test_write_cells_merge_styled(self): | ||
| import warnings | ||
| from pandas.formats.format import ExcelCell | ||
| from openpyxl import styles | ||
|
|
||
|
|
@@ -1962,13 +1963,14 @@ def test_write_cells_merge_styled(self): | |
| ] | ||
|
|
||
| with ensure_clean('.xlsx') as path: | ||
| warnings.simplefilter('error', UserWarning) | ||
| writer = _Openpyxl20Writer(path) | ||
| writer.write_cells(initial_cells, sheet_name=sheet_name) | ||
| writer.write_cells(merge_cells, sheet_name=sheet_name) | ||
|
|
||
| wks = writer.sheets[sheet_name] | ||
| xcell_b1 = wks.cell('B1') | ||
| xcell_a2 = wks.cell('A2') | ||
| xcell_b1 = wks['B1'] | ||
| xcell_a2 = wks['A2'] | ||
| self.assertEqual(xcell_b1.style, openpyxl_sty_merged) | ||
| self.assertEqual(xcell_a2.style, openpyxl_sty_merged) | ||
|
|
||
|
|
@@ -2052,7 +2054,8 @@ def test_to_excel_styleconverter(self): | |
| def test_write_cells_merge_styled(self): | ||
| if not openpyxl_compat.is_compat(major_ver=2): | ||
| raise nose.SkipTest('incompatiable openpyxl version') | ||
|
|
||
|
|
||
| import warnings | ||
| from pandas.formats.format import ExcelCell | ||
|
|
||
| sheet_name = 'merge_styled' | ||
|
|
@@ -2074,13 +2077,14 @@ def test_write_cells_merge_styled(self): | |
| ] | ||
|
|
||
| with ensure_clean('.xlsx') as path: | ||
| warnings.simplefilter('error', UserWarning) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use assert_produces_warning |
||
| writer = _Openpyxl22Writer(path) | ||
| writer.write_cells(initial_cells, sheet_name=sheet_name) | ||
| writer.write_cells(merge_cells, sheet_name=sheet_name) | ||
|
|
||
| wks = writer.sheets[sheet_name] | ||
| xcell_b1 = wks.cell('B1') | ||
| xcell_a2 = wks.cell('A2') | ||
| xcell_b1 = wks['B1'] | ||
| xcell_a2 = wks['A2'] | ||
| self.assertEqual(xcell_b1.font, openpyxl_sty_merged) | ||
| self.assertEqual(xcell_a2.font, openpyxl_sty_merged) | ||
|
|
||
|
|
@@ -2176,9 +2180,9 @@ def test_column_format(self): | |
| read_workbook = openpyxl.load_workbook(path) | ||
| read_worksheet = read_workbook.get_sheet_by_name(name='Sheet1') | ||
|
|
||
| # Get the number format from the cell. This method is backward | ||
| # compatible with older versions of openpyxl. | ||
| cell = read_worksheet.cell('B2') | ||
| # Get the number format from the cell. This method is current | ||
| # with openpyxl latest release. | ||
| cell = read_worksheet['B2'] | ||
|
|
||
| try: | ||
| read_num_format = cell.number_format | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of these changes need to be back-compat. so need to switch code based on the version.