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
c67fa730
Commit
c67fa730
authored
Nov 18, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial
parent
a84477cc
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
0 deletions
+110
-0
lib/Components/ExtensionClass/test/test_add.py
lib/Components/ExtensionClass/test/test_add.py
+9
-0
lib/Components/ExtensionClass/test/test_binding.py
lib/Components/ExtensionClass/test/test_binding.py
+15
-0
lib/Components/ExtensionClass/test/test_explicit_acquisition.py
...mponents/ExtensionClass/test/test_explicit_acquisition.py
+19
-0
lib/Components/ExtensionClass/test/test_func_attr.py
lib/Components/ExtensionClass/test/test_func_attr.py
+52
-0
lib/Components/ExtensionClass/test/test_method_hook.py
lib/Components/ExtensionClass/test/test_method_hook.py
+15
-0
No files found.
lib/Components/ExtensionClass/test/test_add.py
0 → 100644
View file @
c67fa730
from
ExtensionClass
import
*
class
foo
(
Base
):
def
__add__
(
self
,
other
):
print
'add called'
foo
()
+
foo
()
lib/Components/ExtensionClass/test/test_binding.py
0 → 100644
View file @
c67fa730
from
ExtensionClass
import
Base
from
MethodObject
import
Method
class
foo
(
Method
):
def
__call__
(
self
,
ob
,
*
args
,
**
kw
):
print
'called'
,
ob
,
args
,
kw
class
bar
(
Base
):
hi
=
foo
()
x
=
bar
()
hi
=
x
.
hi
print
hi
hi
(
1
,
2
,
3
,
name
=
'spam'
)
lib/Components/ExtensionClass/test/test_explicit_acquisition.py
0 → 100644
View file @
c67fa730
from
ExtensionClass
import
Base
import
Acquisition
class
B
(
Base
):
color
=
'red'
class
A
(
Acquisition
.
Explicit
):
def
hi
(
self
):
print
self
,
self
.
acquire
(
'color'
)
b
=
B
()
b
.
a
=
A
()
b
.
a
.
hi
()
b
.
a
.
color
=
'green'
b
.
a
.
hi
()
try
:
A
().
hi
()
raise
'Program error'
,
'spam'
except
AttributeError
:
pass
lib/Components/ExtensionClass/test/test_func_attr.py
0 → 100644
View file @
c67fa730
#! /usr/bin/env python
"""Test function attributes
Jim Fulton
"""
verbose
=
1
from
ExtensionClass
import
Base
def
f
(
a
):
return
a
*
a
class
C
(
Base
):
def
m
(
self
,
a
):
return
a
*
a
m
.
spam
=
'eggs'
i
=
C
()
if
verbose
:
print
'Trying function wo attributes'
if
f
(
2
)
!=
4
:
print
'failed'
if
verbose
:
print
'Trying method wo attributes'
if
i
.
m
(
2
)
!=
4
:
print
'failed'
if
verbose
:
print
'Trying setting function attribute'
f
.
spam
=
'eggs'
if
verbose
:
print
'Trying function w attributes'
if
f
(
2
)
!=
4
:
print
'failed'
if
verbose
:
print
'Trying method w attributes'
if
i
.
m
(
2
)
!=
4
:
print
'failed'
if
verbose
:
print
'Trying method getattr'
try
:
if
i
.
m
.
spam
!=
'eggs'
:
print
'failed'
except
AttributeError
:
print
'failed'
try
:
i
.
m
.
foo
print
'failed'
except
AttributeError
:
pass
if
verbose
:
print
'Trying setting built-in function attribute'
max
.
color
=
'red'
if
max
.
color
!=
'red'
:
print
'failed'
if
max
(
1
,
2
)
!=
2
:
print
'failed'
if
verbose
:
print
'Trying setting built-in method attribute'
import
sys
try
:
sys
.
stdout
.
write
.
color
=
'green'
print
'failed'
except
TypeError
:
pass
lib/Components/ExtensionClass/test/test_method_hook.py
0 → 100644
View file @
c67fa730
import
ExtensionClass
class
C
(
ExtensionClass
.
Base
):
def
__call_method__
(
self
,
meth
,
args
,
kw
=
{}):
print
'give us a hook, hook, hook...'
apply
(
meth
,
args
,
kw
)
def
hi
(
self
,
*
args
,
**
kw
):
print
self
,
args
,
kw
c
=
C
()
c
.
hi
()
c
.
hi
(
1
,
2
,
3
)
c
.
hi
(
1
,
2
,
spam
=
'eggs'
)
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