Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
e705fb5f
Unverified
Commit
e705fb5f
authored
Aug 31, 2023
by
Sergei Izmailov
Committed by
GitHub
Aug 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix enum's `__str__` docstring (#4827)
* fix: Enum __str__ function name * tests: Test enum.__str__.__doc__
parent
1adac5a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
+6
-1
include/pybind11/pybind11.h
+1
-1
tests/test_enum.py
+5
-0
No files found.
include/pybind11/pybind11.h
View file @
e705fb5f
...
...
@@ -2014,7 +2014,7 @@ struct enum_base {
object
type_name
=
type
::
handle_of
(
arg
).
attr
(
"__name__"
);
return
pybind11
::
str
(
"{}.{}"
).
format
(
std
::
move
(
type_name
),
enum_name
(
arg
));
},
name
(
"
name
"
),
name
(
"
__str__
"
),
is_method
(
m_base
));
if
(
options
::
show_enum_members_docstring
())
{
...
...
tests/test_enum.py
View file @
e705fb5f
...
...
@@ -264,3 +264,8 @@ def test_docstring_signatures():
for
attr
in
enum_type
.
__dict__
.
values
():
# Issue #2623/PR #2637: Add argument names to enum_ methods
assert
"arg0"
not
in
(
attr
.
__doc__
or
""
)
def
test_str_signature
():
for
enum_type
in
[
m
.
ScopedEnum
,
m
.
UnscopedEnum
]:
assert
enum_type
.
__str__
.
__doc__
.
startswith
(
"__str__"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment