mirror of https://github.com/python/cpython
Simple fixes.
This commit is contained in:
parent
f0d8b6eee9
commit
d68d131d29
|
@ -7,7 +7,7 @@ class MemFunctionsTest(unittest.TestCase):
|
||||||
# large buffers apparently increase the chance that the memory
|
# large buffers apparently increase the chance that the memory
|
||||||
# is allocated in high address space.
|
# is allocated in high address space.
|
||||||
a = create_string_buffer(1000000)
|
a = create_string_buffer(1000000)
|
||||||
p = "Hello, World"
|
p = b"Hello, World"
|
||||||
result = memmove(a, p, len(p))
|
result = memmove(a, p, len(p))
|
||||||
self.failUnlessEqual(a.value, "Hello, World")
|
self.failUnlessEqual(a.value, "Hello, World")
|
||||||
|
|
||||||
|
@ -32,14 +32,14 @@ class MemFunctionsTest(unittest.TestCase):
|
||||||
[97, 98, 99, 100, 101, 102, 0])
|
[97, 98, 99, 100, 101, 102, 0])
|
||||||
|
|
||||||
def test_string_at(self):
|
def test_string_at(self):
|
||||||
s = string_at("foo bar")
|
s = string_at(b"foo bar")
|
||||||
# XXX The following may be wrong, depending on how Python
|
# XXX The following may be wrong, depending on how Python
|
||||||
# manages string instances
|
# manages string instances
|
||||||
self.failUnlessEqual(2, sys.getrefcount(s))
|
self.failUnlessEqual(2, sys.getrefcount(s))
|
||||||
self.failUnless(s, "foo bar")
|
self.failUnless(s, "foo bar")
|
||||||
|
|
||||||
self.failUnlessEqual(string_at("foo bar", 8), "foo bar\0")
|
self.failUnlessEqual(string_at(b"foo bar", 8), "foo bar\0")
|
||||||
self.failUnlessEqual(string_at("foo bar", 3), "foo")
|
self.failUnlessEqual(string_at(b"foo bar", 3), "foo")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
create_unicode_buffer
|
create_unicode_buffer
|
||||||
|
|
Loading…
Reference in New Issue