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
dbec8caa
Commit
dbec8caa
authored
Jan 24, 2021
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Systematically renaming tests to use "class_sh" in the name.
parent
562eb995
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
45 additions
and
45 deletions
+45
-45
tests/class_sh_module_local_0.cpp
+5
-5
tests/class_sh_module_local_1.cpp
+6
-6
tests/class_sh_module_local_2.cpp
+6
-6
tests/test_class_sh_basic.cpp
+6
-6
tests/test_class_sh_basic.py
+1
-1
tests/test_class_sh_inheritance.cpp
+10
-10
tests/test_class_sh_inheritance.py
+1
-1
tests/test_class_sh_module_local.py
+3
-3
tests/test_class_sh_unique_ptr_member.cpp
+6
-6
tests/test_class_sh_unique_ptr_member.py
+1
-1
No files found.
tests/classh_module_local_0.cpp
→
tests/class
_s
h_module_local_0.cpp
View file @
dbec8caa
...
...
@@ -4,7 +4,7 @@
#include <string>
namespace
pybind11_tests
{
namespace
classh_module_local
{
namespace
class
_s
h_module_local
{
struct
atyp
{
// Short for "any type".
std
::
string
mtxt
;
...
...
@@ -14,13 +14,13 @@ std::string get_mtxt(const atyp &obj) { return obj.mtxt; }
atyp
rtrn_valu_atyp
()
{
return
atyp
();
}
}
// namespace classh_module_local
}
// namespace class
_s
h_module_local
}
// namespace pybind11_tests
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_module_local
::
atyp
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_module_local
::
atyp
)
PYBIND11_MODULE
(
classh_module_local_0
,
m
)
{
using
namespace
pybind11_tests
::
classh_module_local
;
PYBIND11_MODULE
(
class
_s
h_module_local_0
,
m
)
{
using
namespace
pybind11_tests
::
class
_s
h_module_local
;
m
.
def
(
"get_mtxt"
,
get_mtxt
);
...
...
tests/classh_module_local_1.cpp
→
tests/class
_s
h_module_local_1.cpp
View file @
dbec8caa
// Identical to classh_module_local_2.cpp, except 2 replaced with 1.
// Identical to class
_s
h_module_local_2.cpp, except 2 replaced with 1.
#include <pybind11/pybind11.h>
#include <pybind11/smart_holder.h>
#include <string>
namespace
pybind11_tests
{
namespace
classh_module_local
{
namespace
class
_s
h_module_local
{
struct
atyp
{
// Short for "any type".
std
::
string
mtxt
;
...
...
@@ -13,14 +13,14 @@ struct atyp { // Short for "any type".
std
::
string
get_mtxt
(
const
atyp
&
obj
)
{
return
obj
.
mtxt
;
}
}
// namespace classh_module_local
}
// namespace class
_s
h_module_local
}
// namespace pybind11_tests
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_module_local
::
atyp
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_module_local
::
atyp
)
PYBIND11_MODULE
(
classh_module_local_1
,
m
)
{
PYBIND11_MODULE
(
class
_s
h_module_local_1
,
m
)
{
namespace
py
=
pybind11
;
using
namespace
pybind11_tests
::
classh_module_local
;
using
namespace
pybind11_tests
::
class
_s
h_module_local
;
py
::
class_
<
atyp
,
py
::
smart_holder
>
(
m
,
"atyp"
,
py
::
module_local
())
.
def
(
py
::
init
([](
const
std
::
string
&
mtxt
)
{
...
...
tests/classh_module_local_2.cpp
→
tests/class
_s
h_module_local_2.cpp
View file @
dbec8caa
// Identical to classh_module_local_1.cpp, except 1 replaced with 2.
// Identical to class
_s
h_module_local_1.cpp, except 1 replaced with 2.
#include <pybind11/pybind11.h>
#include <pybind11/smart_holder.h>
#include <string>
namespace
pybind11_tests
{
namespace
classh_module_local
{
namespace
class
_s
h_module_local
{
struct
atyp
{
// Short for "any type".
std
::
string
mtxt
;
...
...
@@ -13,14 +13,14 @@ struct atyp { // Short for "any type".
std
::
string
get_mtxt
(
const
atyp
&
obj
)
{
return
obj
.
mtxt
;
}
}
// namespace classh_module_local
}
// namespace class
_s
h_module_local
}
// namespace pybind11_tests
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_module_local
::
atyp
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_module_local
::
atyp
)
PYBIND11_MODULE
(
classh_module_local_2
,
m
)
{
PYBIND11_MODULE
(
class
_s
h_module_local_2
,
m
)
{
namespace
py
=
pybind11
;
using
namespace
pybind11_tests
::
classh_module_local
;
using
namespace
pybind11_tests
::
class
_s
h_module_local
;
py
::
class_
<
atyp
,
py
::
smart_holder
>
(
m
,
"atyp"
,
py
::
module_local
())
.
def
(
py
::
init
([](
const
std
::
string
&
mtxt
)
{
...
...
tests/test_class
h_wip
.cpp
→
tests/test_class
_sh_basic
.cpp
View file @
dbec8caa
...
...
@@ -6,7 +6,7 @@
#include <string>
namespace
pybind11_tests
{
namespace
class
h_wip
{
namespace
class
_sh_basic
{
struct
atyp
{
// Short for "any type".
std
::
string
mtxt
;
...
...
@@ -46,15 +46,15 @@ std::string pass_uqcp_atyp(std::unique_ptr<atyp const> obj) { return "pass_uqcp:
std
::
string
get_mtxt
(
atyp
const
&
obj
)
{
return
obj
.
mtxt
;
}
std
::
unique_ptr
<
atyp
>
unique_ptr_roundtrip
(
std
::
unique_ptr
<
atyp
>
obj
)
{
return
obj
;
}
}
// namespace class
h_wip
}
// namespace class
_sh_basic
}
// namespace pybind11_tests
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
h_wip
::
atyp
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_sh_basic
::
atyp
)
namespace
pybind11_tests
{
namespace
class
h_wip
{
namespace
class
_sh_basic
{
TEST_SUBMODULE
(
class
h_wip
,
m
)
{
TEST_SUBMODULE
(
class
_sh_basic
,
m
)
{
namespace
py
=
pybind11
;
py
::
class_
<
atyp
,
py
::
smart_holder
>
(
m
,
"atyp"
)
...
...
@@ -97,5 +97,5 @@ TEST_SUBMODULE(classh_wip, m) {
m
.
def
(
"unique_ptr_roundtrip"
,
unique_ptr_roundtrip
);
// pass_uqmp_atyp, rtrn_uqmp_atyp
}
}
// namespace class
h_wip
}
// namespace class
_sh_basic
}
// namespace pybind11_tests
tests/test_class
h_wip
.py
→
tests/test_class
_sh_basic
.py
View file @
dbec8caa
# -*- coding: utf-8 -*-
import
pytest
from
pybind11_tests
import
class
h_wip
as
m
from
pybind11_tests
import
class
_sh_basic
as
m
def
test_atyp_constructors
():
...
...
tests/test_classh_inheritance.cpp
→
tests/test_class
_s
h_inheritance.cpp
View file @
dbec8caa
...
...
@@ -5,7 +5,7 @@
#include <memory>
namespace
pybind11_tests
{
namespace
classh_inheritance
{
namespace
class
_s
h_inheritance
{
template
<
int
Id
>
struct
base_template
{
...
...
@@ -53,20 +53,20 @@ inline int pass_cptr_base2(base2 const *b) { return b->id() + 22; }
inline
int
pass_cptr_drvd2
(
drvd2
const
*
d
)
{
return
d
->
id
()
+
23
;
}
// clang-format on
}
// namespace classh_inheritance
}
// namespace class
_s
h_inheritance
}
// namespace pybind11_tests
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_inheritance
::
base
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_inheritance
::
drvd
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_inheritance
::
base
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_inheritance
::
drvd
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_inheritance
::
base1
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_inheritance
::
base2
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
classh_inheritance
::
drvd2
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_inheritance
::
base1
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_inheritance
::
base2
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class
_s
h_inheritance
::
drvd2
)
namespace
pybind11_tests
{
namespace
classh_inheritance
{
namespace
class
_s
h_inheritance
{
TEST_SUBMODULE
(
classh_inheritance
,
m
)
{
TEST_SUBMODULE
(
class
_s
h_inheritance
,
m
)
{
py
::
class_
<
base
,
py
::
smart_holder
>
(
m
,
"base"
);
py
::
class_
<
drvd
,
base
,
py
::
smart_holder
>
(
m
,
"drvd"
);
...
...
@@ -95,5 +95,5 @@ TEST_SUBMODULE(classh_inheritance, m) {
m
.
def
(
"pass_cptr_drvd2"
,
pass_cptr_drvd2
);
}
}
// namespace classh_inheritance
}
// namespace class
_s
h_inheritance
}
// namespace pybind11_tests
tests/test_classh_inheritance.py
→
tests/test_class
_s
h_inheritance.py
View file @
dbec8caa
# -*- coding: utf-8 -*-
from
pybind11_tests
import
classh_inheritance
as
m
from
pybind11_tests
import
class
_s
h_inheritance
as
m
def
test_rtrn_mptr_drvd_pass_cptr_base
():
...
...
tests/test_classh_module_local.py
→
tests/test_class
_s
h_module_local.py
View file @
dbec8caa
# -*- coding: utf-8 -*-
import
pytest
import
classh_module_local_0
as
m0
import
classh_module_local_1
as
m1
import
classh_module_local_2
as
m2
import
class
_s
h_module_local_0
as
m0
import
class
_s
h_module_local_1
as
m1
import
class
_s
h_module_local_2
as
m2
def
test_cross_module_get_mtxt
():
...
...
tests/test_unique_ptr_member.cpp
→
tests/test_
class_sh_
unique_ptr_member.cpp
View file @
dbec8caa
...
...
@@ -5,7 +5,7 @@
#include <memory>
namespace
pybind11_tests
{
namespace
unique_ptr_member
{
namespace
class_sh_
unique_ptr_member
{
class
pointee
{
// NOT copyable.
public:
...
...
@@ -37,15 +37,15 @@ private:
std
::
unique_ptr
<
pointee
>
ptr_
;
};
}
// namespace unique_ptr_member
}
// namespace
class_sh_
unique_ptr_member
}
// namespace pybind11_tests
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
unique_ptr_member
::
pointee
)
PYBIND11_SMART_HOLDER_TYPE_CASTERS
(
pybind11_tests
::
class_sh_
unique_ptr_member
::
pointee
)
namespace
pybind11_tests
{
namespace
unique_ptr_member
{
namespace
class_sh_
unique_ptr_member
{
TEST_SUBMODULE
(
unique_ptr_member
,
m
)
{
TEST_SUBMODULE
(
class_sh_
unique_ptr_member
,
m
)
{
py
::
class_
<
pointee
,
py
::
smart_holder
>
(
m
,
"pointee"
)
.
def
(
py
::
init
<>
())
.
def
(
"get_int"
,
&
pointee
::
get_int
);
...
...
@@ -59,5 +59,5 @@ TEST_SUBMODULE(unique_ptr_member, m) {
.
def
(
"give_up_ownership_via_shared_ptr"
,
&
ptr_owner
::
give_up_ownership_via_shared_ptr
);
}
}
// namespace unique_ptr_member
}
// namespace
class_sh_
unique_ptr_member
}
// namespace pybind11_tests
tests/test_unique_ptr_member.py
→
tests/test_
class_sh_
unique_ptr_member.py
View file @
dbec8caa
# -*- coding: utf-8 -*-
import
pytest
from
pybind11_tests
import
unique_ptr_member
as
m
from
pybind11_tests
import
class_sh_
unique_ptr_member
as
m
def
test_make_unique_pointee
():
...
...
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