summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-10-24 18:55:37 (GMT)
committerGeorg Brandl <georg@python.org>2007-10-24 18:55:37 (GMT)
commitbd1c68c94f0d5bc25b48f62c7527f51c754f2b6b (patch)
treea468fcccf4193f6d26ce71246e2596de6ffc9eec /Lib/test/test_bytes.py
parent97f9d4f31224e72e5c714ea7e509c4fd0044f0e2 (diff)
downloadcpython-bd1c68c94f0d5bc25b48f62c7527f51c754f2b6b.zip
cpython-bd1c68c94f0d5bc25b48f62c7527f51c754f2b6b.tar.gz
cpython-bd1c68c94f0d5bc25b48f62c7527f51c754f2b6b.tar.bz2
Patch #1303: Adapt str8 constructor to bytes (now buffer) one.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py62
1 files changed, 31 insertions, 31 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index c7c6bd3..2a4b6d8 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -103,33 +103,33 @@ class BytesTest(unittest.TestCase):
self.failIf(b3 <= b2)
def test_compare_to_str(self):
- self.assertEqual(b"abc" == str8("abc"), True)
- self.assertEqual(b"ab" != str8("abc"), True)
- self.assertEqual(b"ab" <= str8("abc"), True)
- self.assertEqual(b"ab" < str8("abc"), True)
- self.assertEqual(b"abc" >= str8("ab"), True)
- self.assertEqual(b"abc" > str8("ab"), True)
-
- self.assertEqual(b"abc" != str8("abc"), False)
- self.assertEqual(b"ab" == str8("abc"), False)
- self.assertEqual(b"ab" > str8("abc"), False)
- self.assertEqual(b"ab" >= str8("abc"), False)
- self.assertEqual(b"abc" < str8("ab"), False)
- self.assertEqual(b"abc" <= str8("ab"), False)
-
- self.assertEqual(str8("abc") == b"abc", True)
- self.assertEqual(str8("ab") != b"abc", True)
- self.assertEqual(str8("ab") <= b"abc", True)
- self.assertEqual(str8("ab") < b"abc", True)
- self.assertEqual(str8("abc") >= b"ab", True)
- self.assertEqual(str8("abc") > b"ab", True)
-
- self.assertEqual(str8("abc") != b"abc", False)
- self.assertEqual(str8("ab") == b"abc", False)
- self.assertEqual(str8("ab") > b"abc", False)
- self.assertEqual(str8("ab") >= b"abc", False)
- self.assertEqual(str8("abc") < b"ab", False)
- self.assertEqual(str8("abc") <= b"ab", False)
+ self.assertEqual(b"abc" == str8(b"abc"), True)
+ self.assertEqual(b"ab" != str8(b"abc"), True)
+ self.assertEqual(b"ab" <= str8(b"abc"), True)
+ self.assertEqual(b"ab" < str8(b"abc"), True)
+ self.assertEqual(b"abc" >= str8(b"ab"), True)
+ self.assertEqual(b"abc" > str8(b"ab"), True)
+
+ self.assertEqual(b"abc" != str8(b"abc"), False)
+ self.assertEqual(b"ab" == str8(b"abc"), False)
+ self.assertEqual(b"ab" > str8(b"abc"), False)
+ self.assertEqual(b"ab" >= str8(b"abc"), False)
+ self.assertEqual(b"abc" < str8(b"ab"), False)
+ self.assertEqual(b"abc" <= str8(b"ab"), False)
+
+ self.assertEqual(str8(b"abc") == b"abc", True)
+ self.assertEqual(str8(b"ab") != b"abc", True)
+ self.assertEqual(str8(b"ab") <= b"abc", True)
+ self.assertEqual(str8(b"ab") < b"abc", True)
+ self.assertEqual(str8(b"abc") >= b"ab", True)
+ self.assertEqual(str8(b"abc") > b"ab", True)
+
+ self.assertEqual(str8(b"abc") != b"abc", False)
+ self.assertEqual(str8(b"ab") == b"abc", False)
+ self.assertEqual(str8(b"ab") > b"abc", False)
+ self.assertEqual(str8(b"ab") >= b"abc", False)
+ self.assertEqual(str8(b"abc") < b"ab", False)
+ self.assertEqual(str8(b"abc") <= b"ab", False)
# Byte comparisons with unicode should always fail!
# Test this for all expected byte orders and Unicode character sizes
@@ -345,7 +345,7 @@ class BytesTest(unittest.TestCase):
self.assertEqual(b.decode("utf8", "ignore"), "Hello world\n")
def test_from_buffer(self):
- sample = str8("Hello world\n\x80\x81\xfe\xff")
+ sample = str8(b"Hello world\n\x80\x81\xfe\xff")
buf = memoryview(sample)
b = bytes(buf)
self.assertEqual(b, bytes(sample))
@@ -367,8 +367,8 @@ class BytesTest(unittest.TestCase):
b1 = b"abc"
b2 = b"def"
self.assertEqual(b1 + b2, b"abcdef")
- self.assertEqual(b1 + str8("def"), b"abcdef")
- self.assertEqual(str8("def") + b1, b"defabc")
+ self.assertEqual(b1 + str8(b"def"), b"abcdef")
+ self.assertEqual(str8(b"def") + b1, b"defabc")
self.assertRaises(TypeError, lambda: b1 + "def")
self.assertRaises(TypeError, lambda: "abc" + b2)
@@ -391,7 +391,7 @@ class BytesTest(unittest.TestCase):
self.assertEqual(b, b"abcdef")
self.assertEqual(b, b1)
self.failUnless(b is b1)
- b += str8("xyz")
+ b += str8(b"xyz")
self.assertEqual(b, b"abcdefxyz")
try:
b += ""