#6780: merge with 3.1.
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index d074758..5eab8f5 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -303,6 +303,11 @@
         self.assertTrue(b.startswith(b"h"))
         self.assertFalse(b.startswith(b"hellow"))
         self.assertFalse(b.startswith(b"ha"))
+        with self.assertRaises(TypeError) as cm:
+            b.startswith([b'h'])
+        exc = str(cm.exception)
+        self.assertIn('bytes', exc)
+        self.assertIn('tuple', exc)
 
     def test_endswith(self):
         b = self.type2test(b'hello')
@@ -312,6 +317,11 @@
         self.assertTrue(b.endswith(b"o"))
         self.assertFalse(b.endswith(b"whello"))
         self.assertFalse(b.endswith(b"no"))
+        with self.assertRaises(TypeError) as cm:
+            b.endswith([b'o'])
+        exc = str(cm.exception)
+        self.assertIn('bytes', exc)
+        self.assertIn('tuple', exc)
 
     def test_find(self):
         b = self.type2test(b'mississippi')
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 65b26c5..97be587 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -819,6 +819,14 @@
         self.assertEqual('%f' % INF, 'inf')
         self.assertEqual('%F' % INF, 'INF')
 
+    def test_startswith_endswith_errors(self):
+        for meth in ('foo'.startswith, 'foo'.endswith):
+            with self.assertRaises(TypeError) as cm:
+                meth(['f'])
+            exc = str(cm.exception)
+            self.assertIn('str', exc)
+            self.assertIn('tuple', exc)
+
     @support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR')
     def test_format_float(self):
         # should not format with a comma, but always with C locale