Skip to content
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

Make test_document compatible with Python 3.13 #281

Merged
merged 1 commit into from
Dec 20, 2023
Merged
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
15 changes: 11 additions & 4 deletions src/zope/interface/tests/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
##############################################################################
"""Documentation tests.
"""
import sys
import unittest


Expand Down Expand Up @@ -50,14 +51,17 @@ class IEmpty(Interface):

def test_asStructuredText_empty_with_multiline_docstring(self):
from zope.interface import Interface
# In Python 3.13+, compiler strips indents from docstrings
indent = " " * 12 if sys.version_info < (3, 13) else ""

EXPECTED = '\n'.join([
"IEmpty",
"",
" This is an empty interface.",
" ",
(" It can be used to annotate any class or object, "
(f"{indent} It can be used to annotate any class or object, "
"because it promises"),
" nothing.",
f"{indent} nothing.",
"",
" Attributes:",
"",
Expand Down Expand Up @@ -274,14 +278,17 @@ class IEmpty(Interface):

def test_asReStructuredText_empty_with_multiline_docstring(self):
from zope.interface import Interface
# In Python 3.13+, compiler strips indents from docstrings
indent = " " * 12 if sys.version_info < (3, 13) else ""

EXPECTED = '\n'.join([
"``IEmpty``",
"",
" This is an empty interface.",
" ",
(" It can be used to annotate any class or object, "
(f"{indent} It can be used to annotate any class or object, "
"because it promises"),
" nothing.",
f"{indent} nothing.",
"",
" Attributes:",
"",
Expand Down