Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/github-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["2.7", "3.6", "3.7", "3.10.1", "3.8", "3.9", "3.10"]

steps:
- name: Checkout Code
Expand Down Expand Up @@ -45,6 +45,11 @@ jobs:
- name: Test with pytest
run: |
python -m coverage run --parallel-mode -m pytest Tests -vv
if: matrix.python-version != '3.10.1'
- name: Test with pytest
run: |
python -OO -m coverage run --parallel-mode -m pytest Tests -vv
if: matrix.python-version == '3.10.1'
- name: Upload coverage data
uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build
.idea/*
*.egg-info/
dist/*
__pycache__/

#
.mutmut-cache
Expand Down
6 changes: 4 additions & 2 deletions PyPDF2/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2287,7 +2287,8 @@ def rotateClockwise(self, angle):
:param int angle: Angle to rotate the page. Must be an increment
of 90 deg.
"""
assert angle % 90 == 0
if angle % 90 != 0:
raise ValueError("Rotation angle must be a multiple of 90")
self._rotate(angle)
return self

Expand All @@ -2298,7 +2299,8 @@ def rotateCounterClockwise(self, angle):
:param int angle: Angle to rotate the page. Must be an increment
of 90 deg.
"""
assert angle % 90 == 0
if angle % 90 != 0:
raise ValueError("Rotation angle must be a multiple of 90")
self._rotate(-angle)
return self

Expand Down
3 changes: 2 additions & 1 deletion Tests/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,6 @@ def test_rotate_45():
with open(os.path.join(RESOURCE_ROOT, "crazyones.pdf"), "rb") as inputfile:
reader = PdfFileReader(inputfile)
page = reader.getPage(0)
with pytest.raises(AssertionError):
with pytest.raises(ValueError) as exc:
page.rotateCounterClockwise(45)
assert exc.value.args[0] == "Rotation angle must be a multiple of 90"