summaryrefslogtreecommitdiff
path: root/tests/test_everything.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-04-07 17:56:24 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-04-07 17:56:24 +0200
commit1f52c1ba5b48364c91d5eb99d1a5bb47b455b259 (patch)
tree2b8c1804c1f5263b824bea886867800a1eb735ea /tests/test_everything.py
parent83d792376fd2d1f4d8b251e104876c192758b3b2 (diff)
downloadpygobject-1f52c1ba5b48364c91d5eb99d1a5bb47b455b259.tar.gz
Move all py2/3 compat code into gi._compat
Diffstat (limited to 'tests/test_everything.py')
-rw-r--r--tests/test_everything.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/test_everything.py b/tests/test_everything.py
index eecd0e79..eab9b95d 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -16,6 +16,7 @@ from gi.repository import Regress as Everything
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
+from gi._compat import PY3, PY2
try:
from gi.repository import Gtk
@@ -23,11 +24,10 @@ try:
except:
Gtk = None
-from .compathelper import PY3
from .helper import capture_exceptions
-if sys.version_info < (3, 0):
+if PY2:
UNICHAR = "\xe2\x99\xa5"
PY2_UNICODE_UNICHAR = unicode(UNICHAR, 'UTF-8')
else:
@@ -35,7 +35,7 @@ else:
const_str = b'const \xe2\x99\xa5 utf8'
-if sys.version_info >= (3, 0):
+if PY3:
const_str = const_str.decode('UTF-8')
noconst_str = 'non' + const_str
@@ -181,7 +181,7 @@ class TestEverything(unittest.TestCase):
def test_unichar(self):
self.assertEqual("c", Everything.test_unichar("c"))
- if sys.version_info < (3, 0):
+ if PY2:
self.assertEqual(UNICHAR, Everything.test_unichar(PY2_UNICODE_UNICHAR))
self.assertEqual(UNICHAR, Everything.test_unichar(UNICHAR))
self.assertRaises(TypeError, Everything.test_unichar, "")
@@ -403,7 +403,7 @@ class TestEverything(unittest.TestCase):
self.assertEqual(Everything.test_array_int_inout([]), [])
def test_array_gint8_in(self):
- if sys.version_info >= (3, 0):
+ if PY3:
self.assertEqual(Everything.test_array_gint8_in(b'\x01\x03\x05'), 9)
self.assertEqual(Everything.test_array_gint8_in([1, 3, 5, -50]), -41)