-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "docstrings.h" |
This file contains 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "genpybind.h" | ||
|
||
/// Describes how the output will taste. | ||
enum class GENPYBIND(visible) Flavor { | ||
/// Like you would expect. | ||
bland, | ||
/// It tastes different. | ||
fruity, | ||
}; | ||
|
||
/// A contrived example. | ||
/// | ||
/// Only the “brief” docstring is used in the Python bindings. | ||
class GENPYBIND(visible) Example {}; | ||
|
||
/// Also here. | ||
class GENPYBIND(dynamic_attr) Dynamic {}; |
This file contains 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import docstrings as m | ||
|
||
|
||
def test_enums_support_docstrings(): | ||
expected = """\ | ||
Describes how the output will taste. | ||
Members: | ||
bland : Like you would expect. | ||
fruity : It tastes different.\ | ||
""" | ||
assert m.Flavor.__doc__ == expected | ||
|
||
|
||
def test_classes_support_docstrings(): | ||
assert m.Example.__doc__ == "A contrived example." | ||
# Docstrings also work with extra arguments to `class_`. | ||
assert m.Dynamic.__doc__ == "Also here." |
This file contains 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 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