FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/src/embed_tests/TestCustomMarshal.cs at master · unknownDev31/pythonnet · GitHub
unknownDev31
pythonnet
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestCustomMarshal.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (30 loc) · 883 Bytes
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestCustomMarshal.cs
Copy path
File metadata and controls
35 lines (30 loc) · 883 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using
System
;
using
NUnit
.
Framework
;
using
Python
.
Runtime
;
namespace
Python
.
EmbeddingTest
{
public
class
TestCustomMarshal
{
[
OneTimeSetUp
]
public
void
SetUp
(
)
{
PythonEngine
.
Initialize
(
)
;
}
[
OneTimeTearDown
]
public
void
Dispose
(
)
{
PythonEngine
.
Shutdown
(
)
;
}
[
Test
]
public
static
void
GetManagedStringTwice
(
)
{
const
string
expected
=
"FooBar"
;
using
var
op
=
Runtime
.
Runtime
.
PyString_FromString
(
expected
)
;
string
s1
=
Runtime
.
Runtime
.
GetManagedString
(
op
.
BorrowOrThrow
(
)
)
;
string
s2
=
Runtime
.
Runtime
.
GetManagedString
(
op
.
Borrow
(
)
)
;
Assert
.
AreEqual
(
1
,
Runtime
.
Runtime
.
Refcount32
(
op
.
Borrow
(
)
)
)
;
Assert
.
AreEqual
(
expected
,
s1
)
;
Assert
.
AreEqual
(
expected
,
s2
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL