FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/src/embed_tests/TestExample.cs at drop-python2 · filmor/pythonnet · GitHub
filmor
/
pythonnet
Public
forked from
pythonnet/pythonnet
Notifications
You must be signed in to change notification settings
Fork
1
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestExample.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (44 loc) · 1.33 KB
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestExample.cs
Copy path
File metadata and controls
53 lines (44 loc) · 1.33 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using
System
;
using
System
.
Collections
.
Generic
;
using
NUnit
.
Framework
;
using
Python
.
Runtime
;
namespace
Python
.
EmbeddingTest
{
public
class
TestExample
{
[
OneTimeSetUp
]
public
void
SetUp
(
)
{
PythonEngine
.
Initialize
(
)
;
}
[
OneTimeTearDown
]
public
void
Dispose
(
)
{
PythonEngine
.
Shutdown
(
)
;
}
[
Test
]
public
void
TestReadme
(
)
{
dynamic
np
;
try
{
np
=
Py
.
Import
(
"numpy"
)
;
}
catch
(
PythonException
)
{
Assert
.
Inconclusive
(
"Numpy or dependency not installed"
)
;
return
;
}
Assert
.
AreEqual
(
"1.0"
,
np
.
cos
(
np
.
pi
*
2
)
.
ToString
(
)
)
;
dynamic
sin
=
np
.
sin
;
StringAssert
.
StartsWith
(
"-0.95892"
,
sin
(
5
)
.
ToString
(
)
)
;
double
c
=
np
.
cos
(
5
)
+
sin
(
5
)
;
Assert
.
AreEqual
(
-
0.675262
,
c
,
0.01
)
;
dynamic
a
=
np
.
array
(
new
List
<
float
>
{
1
,
2
,
3
}
)
;
Assert
.
AreEqual
(
"float64"
,
a
.
dtype
.
ToString
(
)
)
;
dynamic
b
=
np
.
array
(
new
List
<
float
>
{
6
,
5
,
4
}
,
Py
.
kw
(
"dtype"
,
np
.
int32
)
)
;
Assert
.
AreEqual
(
"int32"
,
b
.
dtype
.
ToString
(
)
)
;
Assert
.
AreEqual
(
"[ 6. 10. 12.]"
,
(
a
*
b
)
.
ToString
(
)
.
Replace
(
" "
,
" "
)
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL