summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2021-09-14 16:48:18 +0100
committerSimon McVittie <smcv@collabora.com>2021-09-15 18:49:14 +0100
commit98cbe2b3ace53ef70738345548402cb4e74a4db7 (patch)
tree8214142a629fc4d45b0fc647860b7ae4bd6b9776 /test
parentabd5b946bb2ca9b6c4d2f5e455aaaae5f38946c6 (diff)
Remove support for Python 2
Python 2 reached EOL on 2020-01-01, and the latest version of AX_PYTHON_DEVEL breaks the build with Python 2. This seems as good a time as any to drop compatibility. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/cross-test-client.py16
-rwxr-xr-xtest/cross-test-server.py17
-rw-r--r--test/dbus_py_test.c16
-rwxr-xr-xtest/test-client.py49
-rwxr-xr-xtest/test-exception-py2.py65
-rwxr-xr-xtest/test-p2p.py15
-rwxr-xr-xtest/test-service.py9
-rwxr-xr-xtest/test-standalone.py103
8 files changed, 32 insertions, 258 deletions
diff --git a/test/cross-test-client.py b/test/cross-test-client.py
index fe196ce..4c25499 100755
--- a/test/cross-test-client.py
+++ b/test/cross-test-client.py
@@ -35,24 +35,13 @@ except ImportError:
from dbus import (
Array, Boolean, Byte, ByteArray, Double, Int16, Int32, Int64,
Interface, SessionBus, String, UInt16, UInt32, UInt64)
-from dbus._compat import is_py2, is_py3
import dbus.glib
-if is_py2:
- from dbus import UTF8String
-
from crosstest import (
CROSS_TEST_BUS_NAME, CROSS_TEST_PATH, INTERFACE_CALLBACK_TESTS,
INTERFACE_SIGNAL_TESTS, INTERFACE_SINGLE_TESTS, INTERFACE_TESTS,
SignalTestsImpl)
-if is_py3:
- def make_long(n):
- return n
-else:
- def make_long(n):
- return long(n)
-
logging.basicConfig()
logging.getLogger().setLevel(1)
@@ -246,8 +235,6 @@ class Client(SignalTestsImpl):
# Main tests
self.assert_method_eq(INTERFACE_TESTS, String('foo', variant_level=1), 'Identity', String('foo'))
- if is_py2:
- self.assert_method_eq(INTERFACE_TESTS, String('foo', variant_level=1), 'Identity', UTF8String('foo'))
self.assert_method_eq(INTERFACE_TESTS, Byte(42, variant_level=1), 'Identity', Byte(42))
self.assert_method_eq(INTERFACE_TESTS, Byte(42, variant_level=23), 'Identity', Byte(42, variant_level=23))
self.assert_method_eq(INTERFACE_TESTS, Double(42.5, variant_level=1), 'Identity', 42.5)
@@ -271,11 +258,10 @@ class Client(SignalTestsImpl):
for i in (-0x7fffffff-1, 0, 42, 0x7fffffff):
self.assert_method_eq(INTERFACE_TESTS, i, 'IdentityInt32', Int32(i))
for i in (0, 42, 0xffffffff):
- i = make_long(i)
self.assert_method_eq(INTERFACE_TESTS, i, 'IdentityUInt32', UInt32(i))
MANY = 1
for n in (0x8000, 0x10000, 0x10000, 0x10000):
- MANY *= make_long(n)
+ MANY *= n
for i in (-MANY, 0, 42, MANY-1):
self.assert_method_eq(INTERFACE_TESTS, i, 'IdentityInt64', Int64(i))
for i in (0, 42, 2*MANY - 1):
diff --git a/test/cross-test-server.py b/test/cross-test-server.py
index 3799937..96a315a 100755
--- a/test/cross-test-server.py
+++ b/test/cross-test-server.py
@@ -35,7 +35,6 @@ except ImportError:
import dbus.glib
from dbus import SessionBus
from dbus.service import BusName
-from dbus._compat import is_py2
from crosstest import (
CROSS_TEST_BUS_NAME, CROSS_TEST_PATH, INTERFACE_CALLBACK_TESTS,
@@ -226,12 +225,7 @@ class TestsImpl(dbus.service.Object):
logger.info('Sum of %r is %r', input, x)
return x
-
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
-
- @dbus.service.method(INTERFACE_TESTS, 'a{ss}', 'a{sas}', **kwargs)
+ @dbus.service.method(INTERFACE_TESTS, 'a{ss}', 'a{sas}')
def InvertMapping(self, input):
tested_things.add(INTERFACE_TESTS + '.InvertMapping')
output = dbus.Dictionary({})
@@ -276,8 +270,7 @@ class TestsImpl(dbus.service.Object):
@dbus.service.method(INTERFACE_TESTS, 'st', '',
connection_keyword='conn',
- async_callbacks=('reply_cb', 'error_cb'),
- **kwargs)
+ async_callbacks=('reply_cb', 'error_cb'))
def Trigger(self, object, parameter, conn=None, reply_cb=None,
error_cb=None):
assert isinstance(object, str)
@@ -328,17 +321,13 @@ if __name__ == '__main__':
loop = GLib.MainLoop()
obj = Server(bus_name, CROSS_TEST_PATH, loop.quit)
objects[CROSS_TEST_PATH] = obj
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
bus.add_signal_receiver(obj.triggered_by_client,
signal_name='Trigger',
dbus_interface=INTERFACE_SIGNAL_TESTS,
named_service=None,
path=None,
sender_keyword='sender',
- path_keyword='sender_path',
- **kwargs)
+ path_keyword='sender_path')
logger.info("running...")
loop.run()
diff --git a/test/dbus_py_test.c b/test/dbus_py_test.c
index 7f8f996..6ff8547 100644
--- a/test/dbus_py_test.c
+++ b/test/dbus_py_test.c
@@ -28,11 +28,7 @@
#include <Python.h>
#include <dbus/dbus-python.h>
-#ifdef PY3
PyMODINIT_FUNC PyInit_dbus_py_test(void);
-#else
-PyMODINIT_FUNC initdbus_py_test(void);
-#endif
#if defined(__GNUC__)
# if __GNUC__ >= 3
@@ -119,7 +115,6 @@ static PyMethodDef module_functions[] = {
{NULL, NULL, 0, NULL}
};
-#ifdef PY3
PyMODINIT_FUNC
PyInit_dbus_py_test(void)
{
@@ -139,16 +134,5 @@ PyInit_dbus_py_test(void)
return PyModule_Create(&moduledef);
}
-#else
-PyMODINIT_FUNC
-initdbus_py_test(void)
-{
- PyObject *this_module;
-
- if (import_dbus_bindings("dbus_py_test") < 0) return;
- this_module = Py_InitModule3 ("dbus_py_test", module_functions, "");
- if (!this_module) return;
-}
-#endif
/* vim:set ft=c cino< sw=4 sts=4 et: */
diff --git a/test/test-client.py b/test/test-client.py
index e486309..916ad4f 100755
--- a/test/test-client.py
+++ b/test/test-client.py
@@ -39,8 +39,6 @@ import dbus.lowlevel
import dbus.service
import dbus_test_utils
-from dbus._compat import is_py2, is_py3
-
try:
from gi.repository import GLib
except ImportError:
@@ -128,16 +126,9 @@ class TestDBusBindings(unittest.TestCase):
self.assertEqual(self.iface.AcceptListOfByte(b'\1\2\3', byte_arrays=True), b'\1\2\3')
self.assertEqual(self.iface.AcceptByteArray(b'\1\2\3'), [1,2,3])
self.assertEqual(self.iface.AcceptByteArray(b'\1\2\3', byte_arrays=True), b'\1\2\3')
- if is_py2:
- self.assertTrue(isinstance(self.iface.AcceptUTF8String('abc'), unicode))
- self.assertTrue(isinstance(self.iface.AcceptUTF8String('abc', utf8_strings=True), str))
- unicode_type = (str if is_py3 else unicode)
self.assertTrue(isinstance(self.iface.AcceptUnicodeString('abc'),
- unicode_type))
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
- self.assertTrue(isinstance(self.iface.AcceptUnicodeString('abc', **kwargs), str))
+ str))
+ self.assertTrue(isinstance(self.iface.AcceptUnicodeString('abc'), str))
def testIntrospection(self):
#test introspection
@@ -179,17 +170,6 @@ class TestDBusBindings(unittest.TestCase):
self.assertTrue(destination.startswith(':'))
self.assertEqual(message_cls, 'dbus.lowlevel.MethodCallMessage')
- def testUtf8StringsSync(self):
- if is_py3:
- return
- send_val = 'foo'
- recv_val = self.iface.Echo(send_val, utf8_strings=True)
- self.assertTrue(isinstance(recv_val, str))
- self.assertTrue(isinstance(recv_val, dbus.UTF8String))
- recv_val = self.iface.Echo(send_val, utf8_strings=False)
- self.assertTrue(isinstance(recv_val, unicode))
- self.assertTrue(isinstance(recv_val, dbus.String))
-
def testBenchmarkIntrospect(self):
print("\n********* Benchmark Introspect ************")
a = time.time()
@@ -204,7 +184,6 @@ class TestDBusBindings(unittest.TestCase):
failures = []
report = []
main_loop = GLib.MainLoop()
- unicode_type = (str if is_py3 else unicode)
def message_filter(conn, m):
print('Message filter received message: %r, %r' % (m, m.get_args_list()))
@@ -213,7 +192,7 @@ class TestDBusBindings(unittest.TestCase):
failures.append('Message filter called on unexpected bus')
for a in m.get_args_list():
- if isinstance(a, unicode_type):
+ if isinstance(a, str):
if SHOULD_NOT_HAPPEN in a:
failures.append('Had an unexpected reply')
elif a == 'TestNoReply report':
@@ -263,9 +242,7 @@ class TestDBusBindings(unittest.TestCase):
self.expected_result = expected_result
self.do_exit = do_exit
self.test_controler = test_controler
- if is_py2:
- self.utf8 = kwargs['utf8']
- elif 'utf8' in kwargs:
+ if 'utf8' in kwargs:
raise TypeError("unexpected keyword argument 'utf8'")
def callback(self, val):
@@ -275,13 +252,6 @@ class TestDBusBindings(unittest.TestCase):
self.test_controler.assertEqual(val, self.expected_result)
self.test_controler.assertEqual(val.variant_level, 1)
- if is_py2:
- if self.utf8 and not isinstance(val, dbus.UTF8String):
- failures.append('%r should have been utf8 but was not' % val)
- return
- elif not self.utf8 and isinstance(val, dbus.UTF8String):
- failures.append('%r should not have been utf8' % val)
- return
except Exception as e:
failures.append("%s:\n%s" % (e.__class__, e))
@@ -295,17 +265,10 @@ class TestDBusBindings(unittest.TestCase):
last_type = test_types_vals[-1]
for send_val in test_types_vals:
print("Testing %s" % str(send_val))
- kwargs = {}
- if is_py2:
- utf8 = (send_val == 'gob@gob.com')
- kwargs['utf8'] = utf8
- kwargs['utf8_strings'] = utf8
- check = async_check(self, send_val, last_type == send_val,
- **kwargs)
+ check = async_check(self, send_val, last_type == send_val)
recv_val = self.iface.Echo(send_val,
reply_handler=check.callback,
- error_handler=check.error_handler,
- **kwargs)
+ error_handler=check.error_handler)
main_loop.run()
if failures:
self.assertTrue(False, failures)
diff --git a/test/test-exception-py2.py b/test/test-exception-py2.py
deleted file mode 100755
index a8427c6..0000000
--- a/test/test-exception-py2.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/python
-# -*- coding: utf-8 -*-
-
-# SPDX-License-Identifier: MIT
-
-import sys
-import unittest
-
-import dbus
-import dbus_test_utils
-
-# from test-service.py
-class ServiceError(dbus.DBusException):
- """Exception representing a normal "environmental" error"""
- include_traceback = False
- _dbus_error_name = 'com.example.Networking.ServerError'
-
-
-class DBusExceptionTestCase(unittest.TestCase):
- """Test the DBusException str/unicode behavior with py2"""
-
- def test_dbus_exception_normal(self):
- """Test the normal Exception behavior"""
- e = dbus.exceptions.DBusException("baaa")
- msg = e.get_dbus_message()
- self.assertEqual(msg, u"baaa")
-
- def test_dbus_exception_unicode(self):
- """Test that DBusExceptions that take a py2 unicode work"""
- e = dbus.exceptions.DBusException(u"bäää")
- msg = e.get_dbus_message()
- self.assertEqual(msg, u"bäää")
-
- def test_dbus_exception_convert_str(self):
- """Test that converting a DBusException to str() works as expected"""
- e = dbus.exceptions.DBusException(u"bxxx")
- self.assertEqual(str(e), "bxxx")
-
- def test_dbus_exception_convert_str_fail(self):
- """Test that a non-ascii Exception fails to convert to str"""
- if sys.getdefaultencoding() == 'ascii':
- self.assertRaises(UnicodeEncodeError,
- lambda: str(dbus.exceptions.DBusException(u"bä")))
- else:
- self.skipTest("you're using a weird non-ascii "
- "sys.getdefaultencoding()")
-
- def test_dbus_exception_convert_unicode(self):
- """Test that converting a DBusEception to unicode works"""
- e = dbus.exceptions.DBusException(u"bäää")
- self.assertEqual(e.get_dbus_message(), u"bäää")
- self.assertEqual(e.__unicode__(), u"bäää")
- self.assertEqual(unicode(e), u"bäää")
-
- def test_subclass_exception_unicode(self):
- """Test that DBusExceptions that take a py2 unicode work"""
- e = ServiceError(u"bäää")
- msg = e.get_dbus_message()
- self.assertEqual(msg, u"bäää")
- self.assertEqual(
- unicode(e), u"com.example.Networking.ServerError: bäää")
-
-
-if __name__ == "__main__":
- dbus_test_utils.main()
diff --git a/test/test-p2p.py b/test/test-p2p.py
index efe1041..68f7f71 100755
--- a/test/test-p2p.py
+++ b/test/test-p2p.py
@@ -37,8 +37,6 @@ import dbus.service
import dbus.types
import dbus_test_utils
-from dbus._compat import is_py2
-
try:
from gi.repository import GLib
except ImportError:
@@ -62,15 +60,10 @@ class TestDBusBindings(unittest.TestCase):
# using dbus.bus.BusConnection!
conn = dbus.connection.Connection(
os.environ['DBUS_SESSION_BUS_ADDRESS'])
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
unique = conn.call_blocking('org.freedesktop.DBus',
'/org/freedesktop/DBus',
'org.freedesktop.DBus', 'Hello',
- '', (), **kwargs)
- if is_py2:
- self.assertTrue(unique.__class__ == dbus.UTF8String, repr(unique))
+ '', ())
self.assertTrue(unique.startswith(':'), unique)
conn.set_unique_name(unique)
return conn, unique
@@ -112,12 +105,8 @@ class TestDBusBindings(unittest.TestCase):
def testSetUniqueName(self):
conn, unique = self.get_conn_and_unique()
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
ret = conn.call_blocking(NAME, OBJECT, IFACE,
- 'MethodExtraInfoKeywords', '', (),
- **kwargs)
+ 'MethodExtraInfoKeywords', '', ())
self.assertEqual(ret, (unique, OBJECT, NAME,
'dbus.lowlevel.MethodCallMessage'))
diff --git a/test/test-service.py b/test/test-service.py
index 5440dfa..f0f2819 100755
--- a/test/test-service.py
+++ b/test/test-service.py
@@ -52,7 +52,6 @@ import random
from dbus.gi_service import ExportedGObject
from gi.repository import GLib
-from dbus._compat import is_py2, is_py3
if 'DBUS_TEST_TMPDIR' in os.environ:
@@ -168,14 +167,10 @@ class TestObject(dbus.service.Object, TestInterface):
@dbus.service.method(IFACE, in_signature='s', out_signature='s')
def AcceptUnicodeString(self, foo):
- unicode_type = (str if is_py3 else unicode)
- assert isinstance(foo, unicode_type), (foo, foo.__class__.__mro__)
+ assert isinstance(foo, str), (foo, foo.__class__.__mro__)
return foo
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
- @dbus.service.method(IFACE, in_signature='s', out_signature='s', **kwargs)
+ @dbus.service.method(IFACE, in_signature='s', out_signature='s')
def AcceptUTF8String(self, foo):
assert isinstance(foo, str), (foo, foo.__class__.__mro__)
return foo
diff --git a/test/test-standalone.py b/test/test-standalone.py
index 7ec6e47..055704e 100755
--- a/test/test-standalone.py
+++ b/test/test-standalone.py
@@ -40,18 +40,7 @@ import dbus
import dbus.lowlevel as lowlevel
import dbus.types as types
import dbus_test_utils
-from dbus._compat import is_py2, is_py3
-if is_py3:
- def make_long(n):
- return n
-
- UNICODE = str
-else:
- def make_long(n):
- return long(n)
-
- UNICODE = unicode
if 'DBUS_TEST_UNINSTALLED' in os.environ:
builddir = os.path.normpath(os.environ["DBUS_TOP_BUILDDIR"])
@@ -86,10 +75,7 @@ def uni(x):
supported.
"""
if x <= 0xFFFF:
- if is_py3:
- return chr(x)
- else:
- return unichr(x)
+ return chr(x)
else:
return struct.pack('>I', x).decode('utf_32_be')
@@ -125,7 +111,6 @@ class TestTypes(unittest.TestCase):
self.assertEqual(types.Byte(b'x', variant_level=2),
types.Byte(ord('x')))
self.assertEqual(types.Byte(1), 1)
- self.assertEqual(types.Byte(make_long(1)), 1)
self.assertRaises(Exception, lambda: types.Byte(b'ab'))
self.assertRaises(TypeError, types.Byte, '\x12xxxxxxxxxxxxx')
self.assertEqual(str(types.Byte(b'x')), 'x')
@@ -145,8 +130,6 @@ class TestTypes(unittest.TestCase):
def test_integers(self):
subclasses = [int]
- if is_py2:
- subclasses.append(long)
subclasses = tuple(subclasses)
# This is an API guarantee. Note that exactly which of these types
# are ints and which of them are longs is *not* guaranteed.
@@ -162,12 +145,6 @@ class TestTypes(unittest.TestCase):
self.assertEqual(str(cls(42)), '42')
self.assertIs(type(str(cls(42))), str)
- if is_py2:
- self.assertEqual(long(cls(42)), make_long(42))
- self.assertIs(type(long(cls(42))), long)
- self.assertEqual(unicode(cls(42)), '42'.decode('ascii'))
- self.assertIs(type(unicode(cls(42))), unicode)
-
def test_integer_limits_16(self):
self.assertEqual(types.Int16(0x7fff), 0x7fff)
self.assertEqual(types.Int16(-0x8000), -0x8000)
@@ -178,27 +155,22 @@ class TestTypes(unittest.TestCase):
def test_integer_limits_32(self):
self.assertEqual(types.Int32(0x7fffffff), 0x7fffffff)
- self.assertEqual(types.Int32(make_long(-0x80000000)),
- make_long(-0x80000000))
- self.assertEqual(types.UInt32(make_long(0xffffffff)),
- make_long(0xffffffff))
- self.assertRaises(Exception, types.Int32, make_long(0x80000000))
- self.assertRaises(Exception, types.Int32, make_long(-0x80000001))
- self.assertRaises(Exception, types.UInt32, make_long(0x100000000))
+ self.assertEqual(types.Int32(-0x80000000), -0x80000000)
+ self.assertEqual(types.UInt32(0xffffffff), 0xffffffff)
+ self.assertRaises(Exception, types.Int32, 0x80000000)
+ self.assertRaises(Exception, types.Int32, -0x80000001)
+ self.assertRaises(Exception, types.UInt32, 0x100000000)
def test_integer_limits_64(self):
- self.assertEqual(types.Int64(make_long(0x7fffffffffffffff)),
- make_long(0x7fffffffffffffff))
- self.assertEqual(types.Int64(make_long(-0x8000000000000000)),
- make_long(-0x8000000000000000))
- self.assertEqual(types.UInt64(make_long(0xffffffffffffffff)),
- make_long(0xffffffffffffffff))
- self.assertRaises(Exception, types.Int64,
- make_long(0x8000000000000000))
- self.assertRaises(Exception, types.Int64,
- make_long(-0x8000000000000001))
- self.assertRaises(Exception, types.UInt64,
- make_long(0x10000000000000000))
+ self.assertEqual(types.Int64(0x7fffffffffffffff),
+ 0x7fffffffffffffff)
+ self.assertEqual(types.Int64(-0x8000000000000000),
+ -0x8000000000000000)
+ self.assertEqual(types.UInt64(0xffffffffffffffff),
+ 0xffffffffffffffff)
+ self.assertRaises(Exception, types.Int64, 0x8000000000000000)
+ self.assertRaises(Exception, types.Int64, -0x8000000000000001)
+ self.assertRaises(Exception, types.UInt64, 0x10000000000000000)
def test_Signature(self):
self.assertRaises(Exception, types.Signature, 'a')
@@ -211,31 +183,13 @@ class TestTypes(unittest.TestCase):
self.assertEqual(str(types.Signature('ab')), 'ab')
self.assertIs(type(str(types.Signature('ab'))), str)
- if is_py2:
- self.assertEqual(str(types.Signature('ab')), 'ab')
- self.assertIs(type(str(types.Signature('ab'))), str)
- self.assertEqual(unicode(types.Signature('ab')), 'ab'.decode('ascii'))
- self.assertIs(type(unicode(types.Signature('ab'))), unicode)
-
def test_string(self):
self.assertEqual(types.String('hello', variant_level=23), 'hello')
self.assertEqual(types.String('hello', variant_level=23).variant_level, 23)
- self.assertTrue(isinstance(types.String('hello'), UNICODE))
+ self.assertTrue(isinstance(types.String('hello'), str))
self.assertEqual(str(types.String('hello')), 'hello')
self.assertIs(type(str(types.String('hello'))), str)
- if is_py2:
- self.assertEqual(unicode(types.String('hello')), 'hello'.decode('ascii'))
- self.assertIs(type(unicode(types.String('hello'))), unicode)
-
- self.assertEqual(types.UTF8String('hello', variant_level=23), 'hello')
- self.assertEqual(types.UTF8String('hello', variant_level=23).variant_level, 23)
- self.assertTrue(isinstance(types.UTF8String('hello'), str))
- self.assertEqual(str(types.UTF8String('hello')), 'hello')
- self.assertIs(type(str(types.UTF8String('hello'))), str)
- self.assertEqual(unicode(types.UTF8String('hello')), 'hello'.decode('ascii'))
- self.assertIs(type(unicode(types.UTF8String('hello'))), unicode)
-
def test_object_path(self):
self.assertRaises(Exception, types.ObjectPath, 'a')
self.assertEqual(types.ObjectPath('/ab', variant_level=23), '/ab')
@@ -244,10 +198,6 @@ class TestTypes(unittest.TestCase):
self.assertEqual(str(types.ObjectPath('/ab')), '/ab')
self.assertIs(type(str(types.ObjectPath('/ab'))), str)
- if is_py2:
- self.assertEqual(unicode(types.ObjectPath('/ab')), '/ab'.decode('ascii'))
- self.assertIs(type(unicode(types.ObjectPath('/ab'))), unicode)
-
def test_boolean(self):
self.assertEqual(types.Boolean(True, variant_level=23), True)
self.assertEqual(types.Boolean(True, variant_level=23).variant_level, 23)
@@ -260,10 +210,6 @@ class TestTypes(unittest.TestCase):
self.assertIs(type(int(types.Boolean(False))), int)
self.assertIs(type(int(types.Boolean(True))), int)
- if is_py2:
- self.assertEqual(unicode(types.Boolean(True)), '1'.decode('ascii'))
- self.assertIs(type(unicode(types.Boolean(True))), unicode)
-
class TestMessageMarshalling(unittest.TestCase):
@@ -427,8 +373,6 @@ class TestMessageMarshalling(unittest.TestCase):
aeq = self.assertEqual
from _dbus_bindings import Message
aeq(Message.guess_signature(7), 'i')
- if is_py2:
- aeq(Message.guess_signature(make_long(7)), 'x')
def test_guess_signature_dbus_types(self):
aeq = self.assertEqual
@@ -465,31 +409,20 @@ class TestMessageMarshalling(unittest.TestCase):
aeq(byte.__class__, types.Byte)
aeq(bytes.__class__, types.ByteArray)
aeq(bytes, b'bytes')
- if is_py3:
- aeq(bytes[0].__class__, int)
- else:
- aeq(bytes[0].__class__, str)
+ aeq(bytes[0].__class__, int)
aeq(int32.__class__, types.Int32)
aeq(uint32.__class__, types.UInt32)
aeq(string.__class__, types.String)
aeq(variant.__class__, types.String)
aeq(variant.variant_level, 1)
- kwargs = {}
- if is_py2:
- kwargs['utf8_strings'] = True
- byte, bytes, int32, uint32, string, variant = s.get_args_list(
- **kwargs)
+ byte, bytes, int32, uint32, string, variant = s.get_args_list()
aeq(byte.__class__, types.Byte)
aeq(bytes.__class__, types.Array)
aeq(bytes[0].__class__, types.Byte)
aeq(int32.__class__, types.Int32)
aeq(uint32.__class__, types.UInt32)
- if is_py2:
- aeq(string.__class__, types.UTF8String)
aeq(string, 'str')
- if is_py2:
- aeq(variant.__class__, types.UTF8String)
aeq(variant.variant_level, 1)
aeq(variant, 'var')