FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/src/embed_tests/TestPySequence.cs at v3.2.0-rc1 · pythonnet/pythonnet · GitHub
pythonnet
pythonnet
Repository navigation
Code
Issues
147
(147)
Pull requests
11
(11)
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
83 lines (66 loc) · 2.12 KB
Breadcrumbs
pythonnet
/
src
/
embed_tests
/
TestPySequence.cs
Copy path
File metadata and controls
83 lines (66 loc) · 2.12 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
using
System
;
using
NUnit
.
Framework
;
using
Python
.
Runtime
;
namespace
Python
.
EmbeddingTest
{
public
class
TestPySequence
{
[
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
.
That
(
s
.
ToString
(
)
,
Is
.
EqualTo
(
"Foo"
)
)
;
PyObject
s2
=
t
.
GetSlice
(
3
,
6
)
;
Assert
.
That
(
s2
.
ToString
(
)
,
Is
.
EqualTo
(
"Bar"
)
)
;
PyObject
s3
=
t
.
GetSlice
(
0
,
6
)
;
Assert
.
That
(
s3
.
ToString
(
)
,
Is
.
EqualTo
(
"FooBar"
)
)
;
PyObject
s4
=
t
.
GetSlice
(
0
,
12
)
;
Assert
.
That
(
s4
.
ToString
(
)
,
Is
.
EqualTo
(
"FooBar"
)
)
;
}
[
Test
]
public
void
TestConcat
(
)
{
var
t1
=
new
PyString
(
"Foo"
)
;
var
t2
=
new
PyString
(
"Bar"
)
;
PyObject
actual
=
t1
.
Concat
(
t2
)
;
Assert
.
That
(
actual
.
ToString
(
)
,
Is
.
EqualTo
(
"FooBar"
)
)
;
}
[
Test
]
public
void
TestRepeat
(
)
{
var
t1
=
new
PyString
(
"Foo"
)
;
PyObject
actual
=
t1
.
Repeat
(
3
)
;
Assert
.
That
(
actual
.
ToString
(
)
,
Is
.
EqualTo
(
"FooFooFoo"
)
)
;
actual
=
t1
.
Repeat
(
-
3
)
;
Assert
.
That
(
actual
.
ToString
(
)
,
Is
.
EqualTo
(
""
)
)
;
}
[
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
.
That
(
t1
.
Index32
(
new
PyString
(
"a"
)
)
,
Is
.
EqualTo
(
4
)
)
;
Assert
.
That
(
t1
.
Index64
(
new
PyString
(
"r"
)
)
,
Is
.
EqualTo
(
5L
)
)
;
Assert
.
That
(
t1
.
Index
(
new
PyString
(
"z"
)
)
,
Is
.
EqualTo
(
-
(
nint
)
1
)
)
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL