FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet-rawsvnmig/pythonnet/src/tests/test_interface.py at master · pythonnet/pythonnet-rawsvnmig · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
This repository was archived by the owner on Jun 4, 2019. It is now read-only.
pythonnet
/
pythonnet-rawsvnmig
Public archive
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet-rawsvnmig
/
pythonnet
/
src
/
tests
/
test_interface.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
89 lines (63 loc) · 2.88 KB
Breadcrumbs
pythonnet-rawsvnmig
/
pythonnet
/
src
/
tests
/
test_interface.py
Copy path
File metadata and controls
89 lines (63 loc) · 2.88 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
# ===========================================================================
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# ===========================================================================
from
Python
.
Test
import
InterfaceTest
import
sys
,
os
,
string
,
unittest
,
types
import
Python
.
Test
as
Test
import
System
class
InterfaceTests
(
unittest
.
TestCase
):
"""Test CLR interface support."""
def
testInterfaceStandardAttrs
(
self
):
"""Test standard class attributes."""
from
Python
.
Test
import
IPublicInterface
as
ip
self
.
assertTrue
(
ip
.
__name__
==
'IPublicInterface'
)
self
.
assertTrue
(
ip
.
__module__
==
'Python.Test'
)
self
.
assertTrue
(
type
(
ip
.
__dict__
)
==
types
.
DictProxyType
)
def
testGlobalInterfaceVisibility
(
self
):
"""Test visibility of module-level interfaces."""
from
Python
.
Test
import
IPublicInterface
self
.
assertTrue
(
IPublicInterface
.
__name__
==
'IPublicInterface'
)
def
test
():
from
Python
.
Test
import
IInternalInterface
self
.
assertRaises
(
ImportError
,
test
)
def
test
():
i
=
Test
.
IInternalInterface
self
.
assertRaises
(
AttributeError
,
test
)
def
testNestedInterfaceVisibility
(
self
):
"""Test visibility of nested interfaces."""
ob
=
InterfaceTest
.
IPublic
self
.
assertTrue
(
ob
.
__name__
==
'IPublic'
)
ob
=
InterfaceTest
.
IProtected
self
.
assertTrue
(
ob
.
__name__
==
'IProtected'
)
def
test
():
ob
=
InterfaceTest
.
IInternal
self
.
assertRaises
(
AttributeError
,
test
)
def
test
():
ob
=
InterfaceTest
.
IPrivate
self
.
assertRaises
(
AttributeError
,
test
)
def
testExplicitCastToInterface
(
self
):
"""Test explicit cast to an interface."""
ob
=
InterfaceTest
()
self
.
assertTrue
(
type
(
ob
).
__name__
==
'InterfaceTest'
)
self
.
assertTrue
(
hasattr
(
ob
,
'HelloProperty'
))
i1
=
Test
.
ISayHello1
(
ob
)
self
.
assertTrue
(
type
(
i1
).
__name__
==
'ISayHello1'
)
self
.
assertTrue
(
hasattr
(
i1
,
'SayHello'
))
self
.
assertTrue
(
i1
.
SayHello
()
==
'hello 1'
)
self
.
assertFalse
(
hasattr
(
i1
,
'HelloProperty'
))
i2
=
Test
.
ISayHello2
(
ob
)
self
.
assertTrue
(
type
(
i2
).
__name__
==
'ISayHello2'
)
self
.
assertTrue
(
i2
.
SayHello
()
==
'hello 2'
)
self
.
assertTrue
(
hasattr
(
i2
,
'SayHello'
))
self
.
assertFalse
(
hasattr
(
i2
,
'HelloProperty'
))
def
test_suite
():
return
unittest
.
makeSuite
(
InterfaceTests
)
def
main
():
unittest
.
TextTestRunner
().
run
(
test_suite
())
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL