summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bytes.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-03-06 19:16:20 (GMT)
committerGeorg Brandl <georg@python.org>2007-03-06 19:16:20 (GMT)
commitc78855465fb392db0a821e8ea586a22234857006 (patch)
treee0ed7cef8b534e33399326a38b14a0441face11c /Lib/test/test_bytes.py
parent2e65f892c2ba8b7215345c5138883c677cce76b5 (diff)
downloadcpython-c78855465fb392db0a821e8ea586a22234857006.zip
cpython-c78855465fb392db0a821e8ea586a22234857006.tar.gz
cpython-c78855465fb392db0a821e8ea586a22234857006.tar.bz2
Addendum of patch #1669633: additional tests for bytes methods.
Diffstat (limited to 'Lib/test/test_bytes.py')
-rw-r--r--Lib/test/test_bytes.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index 2aa5339..028cbfd 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -6,6 +6,7 @@ import sys
import tempfile
import unittest
import test.test_support
+import test.string_tests
class BytesTest(unittest.TestCase):
@@ -612,8 +613,38 @@ class BytesTest(unittest.TestCase):
# are not appropriate for bytes
+class BytesAsStringTest(test.string_tests.BaseTest):
+ type2test = bytes
+
+ def checkequal(self, result, object, methodname, *args):
+ object = bytes(object)
+ realresult = getattr(bytes, methodname)(object, *args)
+ self.assertEqual(
+ self.fixtype(result),
+ realresult
+ )
+
+ def checkraises(self, exc, object, methodname, *args):
+ object = bytes(object)
+ self.assertRaises(
+ exc,
+ getattr(bytes, methodname),
+ object,
+ *args
+ )
+
+ # Currently the bytes containment testing uses a single integer
+ # value. This may not be the final design, but until then the
+ # bytes section with in a bytes containment not valid
+ def test_contains(self):
+ pass
+ def test_find(self):
+ pass
+
+
def test_main():
test.test_support.run_unittest(BytesTest)
+ test.test_support.run_unittest(BytesAsStringTest)
if __name__ == "__main__":