summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_binop.py4
-rw-r--r--Lib/test/test_descr.py20
-rw-r--r--Lib/test/test_descrtut.py14
3 files changed, 19 insertions, 19 deletions
diff --git a/Lib/test/test_binop.py b/Lib/test/test_binop.py
index 7eded9a..c64e3a8 100644
--- a/Lib/test/test_binop.py
+++ b/Lib/test/test_binop.py
@@ -48,12 +48,12 @@ class Rat(object):
def _get_num(self):
"""Accessor function for read-only 'num' attribute of Rat."""
return self.__num
- num = getset(_get_num, None)
+ num = property(_get_num, None)
def _get_den(self):
"""Accessor function for read-only 'den' attribute of Rat."""
return self.__den
- den = getset(_get_den, None)
+ den = property(_get_den, None)
def __repr__(self):
"""Convert a Rat to an string resembling a Rat constructor call."""
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index dd411ac..f0f121b 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -578,8 +578,8 @@ def metaclass():
return "E" + self.__super.meth()
verify(E().meth() == "EBCA")
- class autogetset(type):
- # Automatically create getset attributes when methods
+ class autoproperty(type):
+ # Automatically create property attributes when methods
# named _get_x and/or _set_x are found
def __new__(metaclass, name, bases, dict):
hits = {}
@@ -595,11 +595,11 @@ def metaclass():
set = val
hits[key] = get, set
for key, (get, set) in hits.iteritems():
- dict[key] = getset(get, set)
- return super(autogetset, metaclass).__new__(metaclass,
+ dict[key] = property(get, set)
+ return super(autoproperty, metaclass).__new__(metaclass,
name, bases, dict)
class A:
- __metaclass__ = autogetset
+ __metaclass__ = autoproperty
def _get_x(self):
return -self.__x
def _set_x(self, x):
@@ -610,7 +610,7 @@ def metaclass():
verify(a.x == 12)
verify(a._A__x == -12)
- class multimetaclass(autogetset, autosuper):
+ class multimetaclass(autoproperty, autosuper):
# Merge of multiple cooperating metaclasses
pass
class A:
@@ -1274,8 +1274,8 @@ def weakrefs():
verify(r() is None)
del r
-def getsets():
- if verbose: print "Testing getset..."
+def properties():
+ if verbose: print "Testing property..."
class C(object):
def getx(self):
return self.__x
@@ -1283,7 +1283,7 @@ def getsets():
self.__x = value
def delx(self):
del self.__x
- x = getset(getx, setx, delx)
+ x = property(getx, setx, delx)
a = C()
verify(not hasattr(a, "x"))
a.x = 42
@@ -1445,7 +1445,7 @@ def all():
methods()
specials()
weakrefs()
- getsets()
+ properties()
supers()
inherits()
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py
index 121eed5..3847d66 100644
--- a/Lib/test/test_descrtut.py
+++ b/Lib/test/test_descrtut.py
@@ -315,7 +315,7 @@ test_5 = """
Attributes defined by get/set methods
- >>> class getset(object):
+ >>> class property(object):
...
... def __init__(self, get, set=None):
... self.__get = get
@@ -344,7 +344,7 @@ getx() and and setx():
... if x < 0: x = 0
... self.__x = x
...
- ... x = getset(getx, setx)
+ ... x = property(getx, setx)
Here's a small demonstration:
@@ -357,11 +357,11 @@ Here's a small demonstration:
0
>>>
-Hmm -- getset is builtin now, so let's try it that way too.
+Hmm -- property is builtin now, so let's try it that way too.
- >>> del getset # unmask the builtin
- >>> getset
- <type 'getset'>
+ >>> del property # unmask the builtin
+ >>> property
+ <type 'property'>
>>> class C(object):
... def __init__(self):
@@ -371,7 +371,7 @@ Hmm -- getset is builtin now, so let's try it that way too.
... def setx(self, x):
... if x < 0: x = 0
... self.__x = x
- ... x = getset(getx, setx)
+ ... x = property(getx, setx)
>>> a = C()