Ronald Oussoren  committed 7e0ca2c

Use assertStartswith(value, test) instead of assertTrue(value.startswith(test))

  • Participants
  • Parent commits b2d1dc2
  • Branches core-cleanup

Comments (0)

Files changed (3)

File pyobjc-core/Lib/PyObjCTools/

+    if not hasattr(_unittest.TestCase, 'assertStartswith'):
+        def assertStartswith(self, value, test, message = None): # pragma: no cover
+            if not value.startswith(test):
+       or "%r does not start with %r"%(value, test))
     if not hasattr(_unittest.TestCase, 'assertIs'): # pragma: no cover
         def assertIs(self, value, test, message = None):

File pyobjc-core/PyObjCTest/

             self.assertIsInstance(typestr, bytes)
             self.assertIsInstance(doc, (str, type(None)))
             self.assertEqual(len(objc.splitSignature(typestr)), 1)
-            self.assertTrue(typestr.startswith(objc._C_PTR))
+            self.assertStartswith(typestr, objc._C_PTR)
             return '<pointer %r>'%(name,)
         def createStructType(name, typestr, fieldnames, doc=None, pack=-1):

File pyobjc-core/PyObjCTest/

             def foo(self):
-        self.assertTrue(repr('<unbound selector foo of SelectorRepr at'))
+        self.assertStartswith(repr(, '<unbound selector foo of SelectorRepr at')
 class TestCopying (TestCase):