mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Merging the py3k-pep3137 branch back into the py3k branch.
No detailed change log; just check out the change log for the py3k-pep3137 branch. The most obvious changes: - str8 renamed to bytes (PyString at the C level); - bytes renamed to buffer (PyBytes at the C level); - PyString and PyUnicode are no longer compatible. I.e. we now have an immutable bytes type and a mutable bytes type. The behavior of PyString was modified quite a bit, to make it more bytes-like. Some changes are still on the to-do list.
This commit is contained in:
parent
a19f80c6df
commit
98297ee781
148 changed files with 2533 additions and 3517 deletions
|
|
@ -558,10 +558,10 @@ def test_hash(self):
|
|||
a = self.type2test('DNSSEC')
|
||||
b = self.type2test('')
|
||||
for c in a:
|
||||
# Special case for the str8, since indexing returns a integer
|
||||
# XXX Maybe it would be a good idea to seperate str8's tests...
|
||||
if self.type2test == str8:
|
||||
c = chr(c)
|
||||
## # Special case for the str8, since indexing returns a integer
|
||||
## # XXX Maybe it would be a good idea to seperate str8's tests...
|
||||
## if self.type2test == str8:
|
||||
## c = chr(c)
|
||||
b += c
|
||||
hash(b)
|
||||
self.assertEqual(hash(a), hash(b))
|
||||
|
|
@ -992,14 +992,14 @@ def test_join(self):
|
|||
self.checkequal('abc', 'a', 'join', ('abc',))
|
||||
self.checkequal('z', 'a', 'join', UserList(['z']))
|
||||
self.checkequal('a.b.c', '.', 'join', ['a', 'b', 'c'])
|
||||
self.checkequal('a.b.3', '.', 'join', ['a', 'b', 3])
|
||||
self.assertRaises(TypeError, '.'.join, ['a', 'b', 3])
|
||||
for i in [5, 25, 125]:
|
||||
self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
|
||||
['a' * i] * i)
|
||||
self.checkequal(((('a' * i) + '-') * i)[:-1], '-', 'join',
|
||||
('a' * i,) * i)
|
||||
|
||||
self.checkequal(str(BadSeq1()), ' ', 'join', BadSeq1())
|
||||
#self.checkequal(str(BadSeq1()), ' ', 'join', BadSeq1())
|
||||
self.checkequal('a b c', ' ', 'join', BadSeq2())
|
||||
|
||||
self.checkraises(TypeError, ' ', 'join')
|
||||
|
|
@ -1147,16 +1147,16 @@ class subclass(t):
|
|||
s2 = "".join([s1])
|
||||
self.assert_(s1 is s2)
|
||||
|
||||
elif t is str8:
|
||||
s1 = subclass("abcd")
|
||||
s2 = "".join([s1])
|
||||
self.assert_(s1 is not s2)
|
||||
self.assert_(type(s2) is str) # promotes!
|
||||
## elif t is str8:
|
||||
## s1 = subclass("abcd")
|
||||
## s2 = "".join([s1])
|
||||
## self.assert_(s1 is not s2)
|
||||
## self.assert_(type(s2) is str) # promotes!
|
||||
|
||||
s1 = t("abcd")
|
||||
s2 = "".join([s1])
|
||||
self.assert_(s1 is not s2)
|
||||
self.assert_(type(s2) is str) # promotes!
|
||||
## s1 = t("abcd")
|
||||
## s2 = "".join([s1])
|
||||
## self.assert_(s1 is not s2)
|
||||
## self.assert_(type(s2) is str) # promotes!
|
||||
|
||||
else:
|
||||
self.fail("unexpected type for MixinStrUnicodeTest %r" % t)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue