Skip to content

Commit

Permalink
Be more defensive by only relying on six.PY2.
Browse files Browse the repository at this point in the history
  • Loading branch information
sallner committed May 16, 2018
1 parent 6c751ef commit e538bbe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/OFS/tests/testObjectManager.py
Expand Up @@ -9,7 +9,7 @@
from AccessControl.SpecialUsers import emergency_user, nobody, system
from AccessControl.User import User # before SpecialUsers
from Acquisition import aq_self, Implicit
from six import PY2, PY3
from six import PY2
from zExceptions import BadRequest
from zope.component.testing import PlacelessSetup
from zope.interface import implementer
Expand Down Expand Up @@ -528,7 +528,7 @@ def test_empty_string(self):
self.assertEqual(str(e),
"('Empty or invalid id specified', '')")

@unittest.skipIf(PY3, 'Python 3 cannot handle bytestrings here.')
@unittest.skipUnless(PY2, 'Python 3 cannot handle bytestrings here.')
def test_unicode_py2(self):
e = self.assertBadRequest(u'abc☃')
self.assertEqual(
Expand All @@ -538,7 +538,7 @@ def test_unicode_py2(self):
def test_unicode_py3(self):
self._callFUT(self._makeContainer(), u'abc☃')

@unittest.skipIf(PY3, 'Python 3 cannot handle bytestrings here.')
@unittest.skipUnless(PY2, 'Python 3 cannot handle bytestrings here.')
def test_encoded_unicode_py2(self):
self._callFUT(self._makeContainer(), u'abcö'.encode('utf-8'))

Expand All @@ -549,7 +549,7 @@ def test_encoded_unicode_py3(self):
"('Empty or invalid id specified', "
"b'abc\\xc3\\xb6')")

@unittest.skipIf(PY3, 'Python 3 cannot handle bytestrings here.')
@unittest.skipUnless(PY2, 'Python 3 cannot handle bytestrings here.')
def test_unprintable_characters_py2(self):
# We do not allow the first 31 ASCII characters. \x00-\x19
# We do not allow the DEL character. \x7f
Expand Down

0 comments on commit e538bbe

Please sign in to comment.