Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
c6a86f80
Commit
c6a86f80
authored
Aug 24, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for the new getset type.
parent
8b596e27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
Lib/test/test_descr.py
Lib/test/test_descr.py
+24
-0
No files found.
Lib/test/test_descr.py
View file @
c6a86f80
...
...
@@ -1069,6 +1069,29 @@ def weakrefs():
verify
(
r
()
is
None
)
del
r
def
getsets
():
if
verbose
:
print
"Testing getset..."
class
C
(
object
):
def
getx
(
self
):
return
self
.
__x
def
setx
(
self
,
value
):
self
.
__x
=
value
def
delx
(
self
):
del
self
.
__x
x
=
getset
(
getx
,
setx
,
delx
)
a
=
C
()
verify
(
not
hasattr
(
a
,
"x"
))
a
.
x
=
42
verify
(
a
.
_C__x
==
42
)
verify
(
a
.
x
==
42
)
del
a
.
x
verify
(
not
hasattr
(
a
,
"x"
))
verify
(
not
hasattr
(
a
,
"_C__x"
))
C
.
x
.
__set__
(
a
,
100
)
verify
(
C
.
x
.
__get__
(
a
)
==
100
)
## C.x.__set__(a)
## verify(not hasattr(a, "x"))
def
all
():
lists
()
dicts
()
...
...
@@ -1098,6 +1121,7 @@ def all():
methods
()
specials
()
weakrefs
()
getsets
()
all
()
...
...
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