summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-04-14 05:25:50 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-04-14 05:25:50 (GMT)
commitcbd9ee69eeaadf7a50007532071890b4eaeae664 (patch)
tree0e1bcd75cf21a754e466a04db0c97f87cb2086dd /Lib/test/test_descr.py
parente6bdb9be0e7db045a71d6df3c6dd8eb2994c4ab9 (diff)
downloadcpython-cbd9ee69eeaadf7a50007532071890b4eaeae664.zip
cpython-cbd9ee69eeaadf7a50007532071890b4eaeae664.tar.gz
cpython-cbd9ee69eeaadf7a50007532071890b4eaeae664.tar.bz2
When __slots__ are set to a unicode string, make it work the same as
setting a plain string, ie don't expand to single letter identifiers.
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r--Lib/test/test_descr.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py
index 41c0bdf..eda96a6 100644
--- a/Lib/test/test_descr.py
+++ b/Lib/test/test_descr.py
@@ -1225,13 +1225,29 @@ def slots():
raise TestFailed, "[''] slots not caught"
class C(object):
__slots__ = ["a", "a_b", "_a", "A0123456789Z"]
+ # XXX(nnorwitz): was there supposed to be something tested
+ # from the class above?
+
+ # Test a single string is not expanded as a sequence.
+ class C(object):
+ __slots__ = "abc"
+ c = C()
+ c.abc = 5
+ vereq(c.abc, 5)
# Test unicode slot names
try:
- unichr
+ unicode
except NameError:
pass
else:
+ # Test a single unicode string is not expanded as a sequence.
+ class C(object):
+ __slots__ = unicode("abc")
+ c = C()
+ c.abc = 5
+ vereq(c.abc, 5)
+
# _unicode_to_string used to modify slots in certain circumstances
slots = (unicode("foo"), unicode("bar"))
class C(object):