FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/src/embed_tests/TestPySequence.cs at net8.0 · pythonnet/pythonnet · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
pythonnet
/
pythonnet
Public
Notifications
You must be signed in to change notification settings
Fork
780
Star
5.5k
Code
Issues
153
Pull requests
12
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestPySequence.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
95 lines (76 loc) · 2.26 KB
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestPySequence.cs
Copy path
File metadata and controls
95 lines (76 loc) · 2.26 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using
System
;
using
NUnit
.
Framework
;
using
Python
.
Runtime
;
namespace
Python
.
EmbeddingTest
{
public
class
TestPySequence
{
[
OneTimeSetUp
]
public
void
SetUp
(
)
{
PythonEngine
.
Initialize
(
)
;
}
[
OneTimeTearDown
]
public
void
Dispose
(
)
{
PythonEngine
.
Shutdown
(
)
;
}
[
Test
]
public
void
TestIsSequenceTrue
(
)
{
var
t
=
new
PyString
(
"FooBar"
)
;
Assert
.
True
(
PySequence
.
IsSequenceType
(
t
)
)
;
}
[
Test
]
public
void
TestIsSequenceFalse
(
)
{
var
t
=
new
PyInt
(
5
)
;
Assert
.
False
(
PySequence
.
IsSequenceType
(
t
)
)
;
}
[
Test
]
public
void
TestGetSlice
(
)
{
var
t
=
new
PyString
(
"FooBar"
)
;
PyObject
s
=
t
.
GetSlice
(
0
,
3
)
;
Assert
.
AreEqual
(
"Foo"
,
s
.
ToString
(
)
)
;
PyObject
s2
=
t
.
GetSlice
(
3
,
6
)
;
Assert
.
AreEqual
(
"Bar"
,
s2
.
ToString
(
)
)
;
PyObject
s3
=
t
.
GetSlice
(
0
,
6
)
;
Assert
.
AreEqual
(
"FooBar"
,
s3
.
ToString
(
)
)
;
PyObject
s4
=
t
.
GetSlice
(
0
,
12
)
;
Assert
.
AreEqual
(
"FooBar"
,
s4
.
ToString
(
)
)
;
}
[
Test
]
public
void
TestConcat
(
)
{
var
t1
=
new
PyString
(
"Foo"
)
;
var
t2
=
new
PyString
(
"Bar"
)
;
PyObject
actual
=
t1
.
Concat
(
t2
)
;
Assert
.
AreEqual
(
"FooBar"
,
actual
.
ToString
(
)
)
;
}
[
Test
]
public
void
TestRepeat
(
)
{
var
t1
=
new
PyString
(
"Foo"
)
;
PyObject
actual
=
t1
.
Repeat
(
3
)
;
Assert
.
AreEqual
(
"FooFooFoo"
,
actual
.
ToString
(
)
)
;
actual
=
t1
.
Repeat
(
-
3
)
;
Assert
.
AreEqual
(
""
,
actual
.
ToString
(
)
)
;
}
[
Test
]
public
void
TestContains
(
)
{
var
t1
=
new
PyString
(
"FooBar"
)
;
Assert
.
True
(
t1
.
Contains
(
new
PyString
(
"a"
)
)
)
;
Assert
.
False
(
t1
.
Contains
(
new
PyString
(
"z"
)
)
)
;
}
[
Test
]
public
void
TestIndex
(
)
{
var
t1
=
new
PyString
(
"FooBar"
)
;
Assert
.
AreEqual
(
4
,
t1
.
Index32
(
new
PyString
(
"a"
)
)
)
;
Assert
.
AreEqual
(
5L
,
t1
.
Index64
(
new
PyString
(
"r"
)
)
)
;
Assert
.
AreEqual
(
-
(
nint
)
1
,
t1
.
Index
(
new
PyString
(
"z"
)
)
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL