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
08fe834c
Commit
08fe834c
authored
Jan 11, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding mpty::mtxt string member.
parent
1a0dcf46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
tests/test_classh_wip.cpp
+4
-1
tests/test_classh_wip.py
+5
-1
No files found.
tests/test_classh_wip.cpp
View file @
08fe834c
...
@@ -3,11 +3,12 @@
...
@@ -3,11 +3,12 @@
#include <pybind11/classh.h>
#include <pybind11/classh.h>
#include <memory>
#include <memory>
#include <string>
namespace
pybind11_tests
{
namespace
pybind11_tests
{
namespace
classh_wip
{
namespace
classh_wip
{
struct
mpty
{};
struct
mpty
{
std
::
string
mtxt
;
};
mpty
rtrn_mpty_valu
()
{
mpty
obj
;
return
obj
;
}
mpty
rtrn_mpty_valu
()
{
mpty
obj
;
return
obj
;
}
mpty
&&
rtrn_mpty_rref
()
{
mpty
obj
;
return
std
::
move
(
obj
);
}
mpty
&&
rtrn_mpty_rref
()
{
mpty
obj
;
return
std
::
move
(
obj
);
}
...
@@ -192,6 +193,8 @@ TEST_SUBMODULE(classh_wip, m) {
...
@@ -192,6 +193,8 @@ TEST_SUBMODULE(classh_wip, m) {
py
::
classh
<
mpty
>
(
m
,
"mpty"
)
py
::
classh
<
mpty
>
(
m
,
"mpty"
)
.
def
(
py
::
init
<>
())
.
def
(
py
::
init
<>
())
.
def
(
py
::
init
([](
const
std
::
string
&
mtxt
)
{
mpty
obj
;
obj
.
mtxt
=
mtxt
;
return
obj
;
}))
;
;
m
.
def
(
"rtrn_mpty_valu"
,
rtrn_mpty_valu
);
m
.
def
(
"rtrn_mpty_valu"
,
rtrn_mpty_valu
);
...
...
tests/test_classh_wip.py
View file @
08fe834c
...
@@ -4,9 +4,13 @@ import pytest
...
@@ -4,9 +4,13 @@ import pytest
from
pybind11_tests
import
classh_wip
as
m
from
pybind11_tests
import
classh_wip
as
m
def
test_mpty
():
def
test_mpty
_constructors
():
e
=
m
.
mpty
()
e
=
m
.
mpty
()
assert
e
.
__class__
.
__name__
==
"mpty"
assert
e
.
__class__
.
__name__
==
"mpty"
e
=
m
.
mpty
(
""
)
assert
e
.
__class__
.
__name__
==
"mpty"
e
=
m
.
mpty
(
"txtm"
)
assert
e
.
__class__
.
__name__
==
"mpty"
def
test_cast
():
def
test_cast
():
...
...
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