From 8b01ecd553837b834d2e553e1198d841be380a9c Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Thu, 7 Sep 2017 17:52:15 -0500 Subject: Simplify _compat.py now that we only run on newer Pythons - We have u'literals' so we don't need a _u() function. For the record the Emacs replacement regex was `_u(\(['"]\)\([^)]*\)\1) -> u\1\2\1`. Amazingly, I typed that right on the first try. A few things were only used in one (test) file or function, so it was better to keep the use, if any, local and out of the "public" api: - We can use io.StringIO everywhere and it's fast. It was only imported in one file anyway. - We can just import pickle. It was only imported in one file anyway. - TEXT was only used in one test function, `type(u'')` is just as clear (especially since the usual name is `text_type`). - reload was only used in one test function, so move the definition there. --- src/zope/security/tests/test_management.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/zope/security/tests/test_management.py') diff --git a/src/zope/security/tests/test_management.py b/src/zope/security/tests/test_management.py index 8eee32b..83aca7b 100644 --- a/src/zope/security/tests/test_management.py +++ b/src/zope/security/tests/test_management.py @@ -172,17 +172,15 @@ class Test(unittest.TestCase): def test_system_user(self): from zope.security.management import system_user - from zope.security._compat import TEXT - from zope.security._compat import _u + self.assertEqual(system_user.id, - _u('zope.security.management.system_user')) + u'zope.security.management.system_user') - self.assertEqual(system_user.title, _u('System')) + self.assertEqual(system_user.title, u'System') for name in 'id', 'title', 'description': - self.assertTrue(isinstance(getattr(system_user, name), TEXT)) + self.assertIsInstance(getattr(system_user, name), + type(u'')) def test_suite(): - return unittest.TestSuite(( - unittest.makeSuite(Test), - )) + return unittest.defaultTestLoader.loadTestsFromName(__name__) -- cgit v1.2.1