Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11_abseil
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_abseil
Commits
01fd6b4f
Commit
01fd6b4f
authored
Feb 16, 2022
by
Xiaofei Wang
Committed by
Copybara-Service
Feb 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Internal change
PiperOrigin-RevId: 429084023
parent
edf26928
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
pybind11_abseil/register_status_bindings.cc
+6
-2
pybind11_abseil/tests/status_test.py
+2
-2
No files found.
pybind11_abseil/register_status_bindings.cc
View file @
01fd6b4f
...
@@ -146,8 +146,12 @@ void RegisterStatusBindings(module m) {
...
@@ -146,8 +146,12 @@ void RegisterStatusBindings(module m) {
.
def
(
"to_string"
,
[](
const
absl
::
Status
&
s
)
{
return
s
.
ToString
();
})
.
def
(
"to_string"
,
[](
const
absl
::
Status
&
s
)
{
return
s
.
ToString
();
})
.
def
(
"__repr__"
,
[](
const
absl
::
Status
&
s
)
{
return
s
.
ToString
();
})
.
def
(
"__repr__"
,
[](
const
absl
::
Status
&
s
)
{
return
s
.
ToString
();
})
.
def_static
(
"OkStatus"
,
DoNotThrowStatus
(
&
absl
::
OkStatus
))
.
def_static
(
"OkStatus"
,
DoNotThrowStatus
(
&
absl
::
OkStatus
))
.
def
(
"raw_code"
,
&
absl
::
Status
::
code
)
.
def
(
"raw_code"
,
[](
const
absl
::
Status
&
self
)
{
.
def
(
"CanonicalCode"
,
&
absl
::
Status
::
code
)
return
static_cast
<
int
>
(
self
.
code
());
})
.
def
(
"CanonicalCode"
,
[](
const
absl
::
Status
&
self
)
{
return
static_cast
<
int
>
(
self
.
code
());
})
.
def
(
"error_message"
,
&
absl
::
Status
::
message
)
.
def
(
"error_message"
,
&
absl
::
Status
::
message
)
.
def
(
"IgnoreError"
,
&
absl
::
Status
::
IgnoreError
);
.
def
(
"IgnoreError"
,
&
absl
::
Status
::
IgnoreError
);
...
...
pybind11_abseil/tests/status_test.py
View file @
01fd6b4f
...
@@ -129,8 +129,8 @@ class StatusTest(absltest.TestCase):
...
@@ -129,8 +129,8 @@ class StatusTest(absltest.TestCase):
def
test_create_ok_status
(
self
):
def
test_create_ok_status
(
self
):
ok_status
=
status
.
Status
.
OkStatus
()
ok_status
=
status
.
Status
.
OkStatus
()
self
.
assertEqual
(
ok_status
.
to_string
(),
'OK'
)
self
.
assertEqual
(
ok_status
.
to_string
(),
'OK'
)
self
.
assertEqual
(
ok_status
.
raw_code
(),
status
.
StatusCode
.
OK
)
self
.
assertEqual
(
ok_status
.
raw_code
(),
0
)
self
.
assertEqual
(
ok_status
.
CanonicalCode
(),
status
.
StatusCode
.
OK
)
self
.
assertEqual
(
ok_status
.
CanonicalCode
(),
0
)
self
.
assertEqual
(
ok_status
.
error_message
(),
''
)
self
.
assertEqual
(
ok_status
.
error_message
(),
''
)
self
.
assertIsNone
(
ok_status
.
IgnoreError
())
self
.
assertIsNone
(
ok_status
.
IgnoreError
())
...
...
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