FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/tests/utils.py at v3.0.3 · 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
/
tests
/
utils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
135 lines (82 loc) · 2.54 KB
Breadcrumbs
pythonnet
/
tests
/
utils.py
Copy path
File metadata and controls
135 lines (82 loc) · 2.54 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# -*- coding: utf-8 -*-
"""Tests Utilities
Refactor utility functions and classes
"""
DictProxyType
=
type
(
object
.
__dict__
)
def
dprint
(
msg
):
# Debugging helper to trace thread-related tests.
if
0
:
print
(
msg
)
def
is_clr_module
(
ob
):
return
type
(
ob
).
__name__
==
'ModuleObject'
def
is_clr_root_module
(
ob
):
# in Python 3 the clr module is a normal python module
return
ob
.
__name__
==
"clr"
def
is_clr_class
(
ob
):
return
type
(
ob
).
__name__
==
'CLRMetatype'
and
type
(
ob
).
__module__
==
'clr._internal'
# for now
class
ClassicClass
:
def
kind
(
self
):
return
"classic"
class
NewStyleClass
(
object
):
def
kind
(
self
):
return
"new-style"
class
GenericHandler
(
object
):
"""A generic handler to test event callbacks."""
def
__init__
(
self
):
self
.
value
=
None
def
handler
(
self
,
sender
,
args
):
self
.
value
=
args
.
value
class
VariableArgsHandler
(
object
):
"""A variable args handler to test event callbacks."""
def
__init__
(
self
):
self
.
value
=
None
def
handler
(
self
,
*
args
):
ob
,
eventargs
=
args
self
.
value
=
eventargs
.
value
class
CallableHandler
(
object
):
"""A callable handler to test event callbacks."""
def
__init__
(
self
):
self
.
value
=
None
def
__call__
(
self
,
sender
,
args
):
self
.
value
=
args
.
value
class
VarCallableHandler
(
object
):
"""A variable args callable handler to test event callbacks."""
def
__init__
(
self
):
self
.
value
=
None
def
__call__
(
self
,
*
args
):
ob
,
eventargs
=
args
self
.
value
=
eventargs
.
value
class
StaticMethodHandler
(
object
):
"""A static method handler to test event callbacks."""
value
=
None
def
handler
(
sender
,
args
):
StaticMethodHandler
.
value
=
args
.
value
handler
=
staticmethod
(
handler
)
class
ClassMethodHandler
(
object
):
"""A class method handler to test event callbacks."""
value
=
None
def
handler
(
cls
,
sender
,
args
):
cls
.
value
=
args
.
value
handler
=
classmethod
(
handler
)
class
MultipleHandler
(
object
):
"""A generic handler to test multiple callbacks."""
def
__init__
(
self
):
self
.
value
=
0
def
handler
(
self
,
sender
,
args
):
self
.
value
+=
args
.
value
def
count
(
self
):
self
.
value
+=
1
return
'ok'
class
HelloClass
(
object
):
def
hello
(
self
):
return
"hello"
def
__call__
(
self
):
return
"hello"
@
staticmethod
def
s_hello
():
return
"hello"
@
classmethod
def
c_hello
(
cls
):
return
"hello"
def
hello_func
():
return
"hello"
Back
|
FazBrowse Home
|
New Git URL