Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
63c161a0
Commit
63c161a0
authored
Nov 27, 2000
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended test suite...
parent
02bc2ee3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
0 deletions
+98
-0
lib/python/Interface/test.py
lib/python/Interface/test.py
+98
-0
No files found.
lib/python/Interface/test.py
View file @
63c161a0
...
...
@@ -69,3 +69,101 @@ try:
except
:
pass
FooInterface
=
Interface
.
new
(
'FooInterface'
)
print
Interface
.
interface_as_stx
(
FooInterface
)
BarInterface
=
Interface
.
new
(
'BarInterface'
,
[
FooInterface
])
print
Interface
.
interface_as_stx
(
BarInterface
)
BobInterface
=
Interface
.
new
(
'BobInterface'
)
BazInterface
=
Interface
.
new
(
'BazInterface'
,
[
BobInterface
,
BarInterface
])
print
Interface
.
interface_as_stx
(
BazInterface
)
ints
=
[
BazInterface
,
BobInterface
,
BarInterface
,
FooInterface
]
for
int
in
ints
:
for
int2
in
ints
:
if
int
.
extends
(
int2
):
print
"%s DOES extend %s"
%
(
int
.
__name__
,
int2
.
__name__
)
else
:
print
"%s DOES NOT extend %s"
%
(
int
.
__name__
,
int2
.
__name__
)
print
"
\
n
"
# methods and pretty printing
class
AnAbstractBaseClass
:
""" This is an Abstract Base Class """
foobar
=
"fuzzed over beyond all recognition"
def
aMethod
(
self
,
foo
,
bar
,
bingo
):
""" This is aMethod """
pass
def
anotherMethod
(
self
,
foo
=
6
,
bar
=
"where you get sloshed"
,
bingo
=
(
1
,
3
,)):
""" This is anotherMethod """
pass
def
wammy
(
self
,
zip
,
*
argues
):
""" yadda yadda """
pass
def
useless
(
self
,
**
keywords
):
""" useless code is fun! """
pass
AnABCInterface
=
Interface
.
impliedInterface
(
AnAbstractBaseClass
)
print
Interface
.
interface_as_stx
(
AnABCInterface
)
class
AConcreteClass
:
""" A concrete class """
__implements__
=
AnABCInterface
,
def
aMethod
(
self
,
foo
,
bar
,
bingo
):
""" This is aMethod """
return
"barf!"
def
anotherMethod
(
self
,
foo
=
6
,
bar
=
"where you get sloshed"
,
bingo
=
(
1
,
3
,)):
""" This is anotherMethod """
return
"barf!"
def
wammy
(
self
,
zip
,
*
argues
):
""" yadda yadda """
return
"barf!"
def
useless
(
self
,
**
keywords
):
""" useless code is fun! """
return
"barf!"
concrete_instance
=
AConcreteClass
()
class
Blah
:
pass
blah_instance
=
Blah
()
if
AnABCInterface
.
implementedBy
(
concrete_instance
):
print
"%s is an instance that implements %s"
%
(
concrete_instance
,
AnABCInterface
.
__name__
)
if
AnABCInterface
.
implementedByInstancesOf
(
AConcreteClass
):
print
"%s is a class that implements %s"
%
(
AConcreteClass
,
AnABCInterface
.
__name__
)
if
not
AnABCInterface
.
implementedBy
(
blah_instance
):
print
"%s is NOT an instance that implements %s"
%
(
blah_instance
,
AnABCInterface
.
__name__
)
if
not
AnABCInterface
.
implementedByInstancesOf
(
Blah
):
print
"%s is NOT a class that implements %s"
%
(
Blah
,
AnABCInterface
.
__name__
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment